Repository: dmitriz/issue-labeler
Pull request #1: Add initial implementation of Issue Labeler tool
Author: login: dmitriz
Labels: name: Review effort 2/5
name: size:M
description: This PR changes 30-99 lines, ignoring generated files
name: refactor
Created: 2025-05-06T12:17:10Z | Merged: 2025-05-06T12:29:00Z

## **User description**
### **User description**
Introduce an Issue Labeler tool that automatically suggests urgency and importance labels for GitHub issues. Include configuration, a prompt template, and basic usage instructions in the README.


___

### **PR Type**
enhancement, documentation


___

### **Description**
- Introduces an automated GitHub issue labeler tool.
  - Implements a script to suggest urgency and importance labels.
  - Uses a configurable prompt template and model settings.

- Adds initial documentation and usage instructions.

- Provides configuration and package setup for the tool.


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>README.md</strong><dd><code>Add documentation and usage guide for Issue Labeler</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

README.md

<li>Adds overview and usage instructions for the Issue Labeler tool.<br> <li> Explains both direct and npm-based execution.


</details>


  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5">+15/-0</a>&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Configuration changes</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>config.json</strong><dd><code>Add configuration for model and temperature</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

config.json

- Introduces configuration file specifying model and temperature.


</details>


  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-587cb980af76fdc7e52369fd0b9d926dff266976b6f8ac631e358fecc49ff8cf">+4/-0</a>&nbsp; &nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
      <summary><strong>package.json</strong><dd><code>Add package configuration and npm scripts</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

package.json

<li>Adds package metadata and scripts for the tool.<br> <li> Sets up npm start command for labeler.


</details>


  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519">+21/-0</a>&nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>labeler.js</strong><dd><code>Add main script for generating issue labels</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

labeler.js

<li>Implements main script for issue label suggestion.<br> <li> Loads prompt template and config.<br> <li> Demonstrates placeholder issue and simulated output.


</details>


  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-b43b9c70d1f69cd74170f2fa67b3aa6a7107c0767069f2270134385e0e5aebb8">+28/-0</a>&nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
      <summary><strong>prompt-template.txt</strong><dd><code>Add prompt template for issue triage</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

prompt-template.txt

<li>Provides prompt template for model input.<br> <li> Defines placeholders for issue title and body.<br> <li> Specifies expected YAML output format.


</details>


  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-3f784eba2eea059f9f38be1cada5ea65d051e1ed1c2fcb7a050104d7539597f1">+15/-0</a>&nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

___

> <details> <summary>  Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about Qodo Merge usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>


___

## **CodeAnt-AI Description**
- Implements the initial version of the Issue Labeler tool, including the main script (`labeler.js`) that loads a prompt template and configuration, prepares a prompt with dummy issue data, and simulates label suggestions.
- Introduces a prompt template (`prompt-template.txt`) for classifying GitHub issues by urgency and importance, with clear placeholders and output format.
- Adds a configuration file (`config.json`) specifying the model and temperature settings for future model integration.
- Provides a `package.json` with metadata and npm scripts to facilitate running the tool.
- Includes a `README.md` with an overview and step-by-step usage instructions.

This PR establishes the foundation for an automated GitHub issue labeler tool, enabling future integration with the GitHub Models API. It provides clear documentation, configuration, and a working script for initial testing and demonstration.


___

## **Changes walkthrough**
<table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement
</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>labeler.js</strong><dd><code>Initial implementation of Issue Labeler main script with prompt and <br>label simulation</code></dd></summary>
<hr>

labeler.js
<li>Implements the main script for the Issue Labeler tool.<br> <li> Loads a prompt template and configuration file.<br> <li> Prepares a prompt with dummy issue data and outputs it.<br> <li> Simulates label suggestions for urgency and importance.<br>


</details>
    

  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-b43b9c70d1f69cd74170f2fa67b3aa6a7107c0767069f2270134385e0e5aebb8">+28/-0</a>&nbsp; &nbsp; </td>
</tr>                    

<tr>
  <td>
    <details>
      <summary><strong>prompt-template.txt</strong><dd><code>Add prompt template for urgency and importance label assignment</code></dd></summary>
<hr>

prompt-template.txt
<li>Adds a prompt template for the model to classify issue urgency and <br>importance.<br> <li> Defines placeholders for issue title and body.<br> <li> Specifies YAML output format for labels.<br>


</details>
    

  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-3f784eba2eea059f9f38be1cada5ea65d051e1ed1c2fcb7a050104d7539597f1">+15/-0</a>&nbsp; &nbsp; </td>
</tr>                    
</table></td></tr><tr><td><strong>Configuration changes
</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>config.json</strong><dd><code>Add configuration file for model and temperature settings</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

config.json
- Adds configuration file specifying model and temperature settings.



</details>
    

  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-587cb980af76fdc7e52369fd0b9d926dff266976b6f8ac631e358fecc49ff8cf">+4/-0</a>&nbsp; &nbsp; &nbsp; </td>
</tr>                    

<tr>
  <td>
    <details>
      <summary><strong>package.json</strong><dd><code>Add package configuration and npm scripts for Issue Labeler</code>&nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

package.json
<li>Adds package metadata, scripts, and repository information for the <br>Issue Labeler tool.<br> <li> Sets up npm start script to run the main script.<br>


</details>
    

  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519">+21/-0</a>&nbsp; &nbsp; </td>
</tr>                    
</table></td></tr><tr><td><strong>Documentation
</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>README.md</strong><dd><code>Add documentation and usage guide for Issue Labeler tool</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

README.md
<li>Adds overview and usage instructions for the Issue Labeler tool.<br> <li> Explains how to run the tool directly or via npm script.<br>


</details>
    

  </td>
  <td><a href="https://github.com/dmitriz/issue-labeler/pull/1/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5">+15/-0</a>&nbsp; &nbsp; </td>
</tr>                    
</table></td></tr></tr></tbody></table><details>
<summary><strong>💡 Usage Guide</strong></summary>

### Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

### Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
<pre>
<code>@codeant-ai ask: Your question here</code>
</pre>
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

### Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
<pre>
<code>@codeant-ai: review</code>
</pre>

### Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at [https://app.codeant.ai](https://app.codeant.ai). This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

</details>

<!-- Korbit AI PR Description Start -->
## Description by Korbit AI

### What change is being made?

Add an initial implementation of the Issue Labeler tool, which automatically suggests urgency and importance labels for GitHub issues using a prompt-based script, with plans to extend the functionality to leverage the GitHub Models API.

### Why are these changes being made?

These changes provide a foundation for automating the issue management process by prioritizing GitHub issues efficiently, which helps teams manage their workloads and focus on critical tasks. The use of configurable prompts and a placeholder implementation that simulates model response enables incremental development for future enhancements with real API integration.

> Is this description stale? Ask me to generate a new description by commenting `/korbit-generate-pr-description`
<!-- Korbit AI PR Description End -->


Diff:
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2f1d7f2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,19 @@
+# Issue Labeler
+
+This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.
+
+## Usage
+
+## Usage
+
+First, install the dependencies:
+
+```bash
+npm install
+
+```bash
+# Directly with Node.js
+node labeler.js
+
+# Using NPM script
+npm start
\ No newline at end of file
diff --git a/config.json b/config.json
new file mode 100644
index 0000000..9436b91
--- /dev/null
+++ b/config.json
@@ -0,0 +1,4 @@
+{
+  "model": "gpt-4",
+  "temperature": 0.3
+}
\ No newline at end of file
diff --git a/labeler.js b/labeler.js
new file mode 100644
index 0000000..d8c2ccb
--- /dev/null
+++ b/labeler.js
@@ -0,0 +1,45 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+try {
+  const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+} catch (error) {
+  console.error("Failed to read config.json:", error);
+  process.exit(1); // Exit the process to prevent further execution
+}
+
+// Parse command line arguments or use dummy data if none provided
+const issue = (() => {
+  // Check if issue data is provided via command line
+  if (process.argv.length > 2) {
+    try {
+      return JSON.parse(process.argv[2]);
+    } catch (error) {
+      console.error('Error parsing issue data:', error.message);
+    }
+  }
+
+  // Fall back to dummy data
+  return {
+    title: "Enable automatic triage with GitHub models",
+    body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
+  };
+})();
+
+// Replace placeholders in the template
+const prompt = promptTemplate
+  .replace('{{title}}', issue.title)
+  .replace('{{body}}', issue.body);
+
+// Output what would be sent to the model
+console.log("=== Prompt Sent to Model ===\n");
+console.log(prompt);
+
+// Simulate model response (replace this with real API later)
+console.log("\n=== Suggested Labels ===\n");
+console.log("urgency: urgent");
+console.log("importance: high");
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..4a55426
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+  "name": "issue-labeler",
+  "version": "1.0.0",
+  "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
+  "main": "labeler.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "node labeler.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/dmitriz/issue-labeler.git"
+  },
+  "keywords": [],
+  "author": "",
+  "license": "ISC",
+  "bugs": {
+    "url": "https://github.com/dmitriz/issue-labeler/issues"
+  },
+  "homepage": "https://github.com/dmitriz/issue-labeler#readme",
+  "dependencies": {
+    "@octokit/rest": "^19.0.0",
+    "dotenv": "^16.0.0"
+  }
+}
diff --git a/prompt-template.txt b/prompt-template.txt
new file mode 100644
index 0000000..3df7128
--- /dev/null
+++ b/prompt-template.txt
@@ -0,0 +1,22 @@
+You are a GitHub issue triage assistant. Read the issue and assign:
+
+1. **urgency**: Is this urgent or not urgent?
+2. **importance**: Is this high or low importance?
+
+For urgency, consider:
+- "urgent": Issues blocking critical functionality or affecting many users
+- "not urgent": Issues that can be addressed in regular development cycles
+
+For importance, consider:
+- "high": Issues impacting core functionality or user experience
+- "low": Nice-to-have improvements or minor bugs with workarounds
+Return a YAML block in this format:
+
+urgency: <urgent | not urgent>
+importance: <high | low>
+
+Issue:
+Title: {{title}}
+
+Body:
+{{body}}
\ No newline at end of file


Reviews:
user: login: gemini-code-assist[bot]
body: Hello @dmitriz, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

## Summary of Changes
This pull request introduces an initial implementation of an Issue Labeler tool. The tool is designed to automatically suggest urgency and importance labels for GitHub issues using a prompt-based approach. It includes configuration files, a prompt template, and basic usage instructions in the README. The current implementation uses dummy issue data and simulates the model response, with plans to integrate with the GitHub Models API in the future.

### Highlights
* **Initial Implementation**: The pull request provides the first version of the Issue Labeler tool, laying the groundwork for future integration with GitHub Models API.
* **Configuration and Prompt**: It includes a `config.json` file for model configuration (currently set to 'gpt-4' with a temperature of 0.3) and a `prompt-template.txt` file defining the prompt structure for the language model.
* **Basic Usage**: The README.md file provides basic usage instructions for running the labeler directly with Node.js or using an NPM script.

### Changelog
<details>
<summary>Click here to see the changelog</summary>

* **README.md**
  * Added a README file to describe the Issue Labeler tool and its usage.
  * Provides instructions on how to run the labeler using Node.js or an NPM script.
* **config.json**
  * Created a configuration file to specify the model and temperature for the language model.
  * The model is set to 'gpt-4' and the temperature is set to 0.3.
* **labeler.js**
  * Created the main script for the Issue Labeler tool.
  * Loads the prompt template and configuration.
  * Uses dummy issue data for testing purposes.
  * Replaces placeholders in the prompt template with issue title and body.
  * Simulates the model response by printing suggested labels for urgency and importance.
* **package.json**
  * Created a package.json file to define the project metadata and dependencies.
  * Includes a start script to run the labeler using Node.js.
* **prompt-template.txt**
  * Created a prompt template for the language model.
  * Defines the structure of the prompt, including instructions for the model to assign urgency and importance labels based on the issue title and body.

</details>


<details>

<summary><b>Using Gemini Code Assist</b></summary>
<br>

The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.

<b>Invoking Gemini</b>

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands.

Feature | Command | Description
--- | --- | ---
Code Review | `/gemini review` | Performs a code review for the current pull request in its current state.
Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state.
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments.
Help | `/gemini help` | Displays a list of available commands.

<b>Customization</b>

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).

<b>Limitations & Feedback</b>

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments to provide feedback.

</details>

<b>You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the [Gemini Code Assist IDE Extension](https://cloud.google.com/products/gemini/code-assist).</b>


[^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/review-github-code). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).

---

> A labeler's born,
> From issues, insights drawn,
> GPT's wisdom gleams.


state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:17:20Z
user: login: gemini-code-assist[bot]
body: ## Code Review
This pull request introduces an Issue Labeler tool that automatically suggests urgency and importance labels for GitHub issues. The tool uses a prompt-based script and is intended to be extended with the GitHub Models API in the future. Overall, the changes are well-structured and the code is clear. However, there are a few areas that could be improved.

### Summary of Findings
* **Missing Error Handling**: The script reads files without error handling, which could lead to crashes if the files are missing or inaccessible.
* **Lack of Input Validation**: The script uses dummy issue data without any validation, which could lead to unexpected behavior when integrated with real data.
* **Missing NPM Install Step**: The README does not include an `npm install` step, which is necessary to install dependencies before running the script.

### Merge Readiness
The pull request introduces a useful tool with a clear purpose. However, before merging, it's important to address the missing error handling and input validation to ensure the script's robustness. Additionally, the README should be updated to include the `npm install` step. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. I recommend that the pull request not be merged until the high severity issues are addressed.
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:17:34Z
user: login: korbit-ai[bot]
body: ### Review by Korbit AI

###### Korbit automatically attempts to detect when you fix issues in new commits.

| Category | Issue | Status |
|----------|-------|----------|
| <sub>![Documentation](https://img.shields.io/badge/Documentation-7c3aed)</sub> | Unclear temporary implementation comment ▹ [view]( https://github.com/dmitriz/issue-labeler/pull/1#discussion_r2075345778 ) | ✅ Fix detected |
| <sub>![Readability](https://img.shields.io/badge/Readability-0284c7)</sub> | Hardcoded file paths ▹ [view]( https://github.com/dmitriz/issue-labeler/pull/1#discussion_r2075345782 ) ||
| <sub>![Documentation](https://img.shields.io/badge/Documentation-7c3aed)</sub> | Non-informative header comment ▹ [view]( https://github.com/dmitriz/issue-labeler/pull/1#discussion_r2075345779 ) ||
| <sub>![Error Handling](https://img.shields.io/badge/Error%20Handling-ea580c)</sub> | Missing File Read Error Handling ▹ [view]( https://github.com/dmitriz/issue-labeler/pull/1#discussion_r2075345785 ) ||
| <sub>![Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub> | Missing Issue Property Validation ▹ [view]( https://github.com/dmitriz/issue-labeler/pull/1#discussion_r2075345773 ) ||






<details>
  <summary>Files scanned</summary>
&#8203;



| File Path | Reviewed |
| ------------------ | -------------- |
| labeler.js | ✅ |


> Explore our [documentation](https://docs.korbit.ai) to understand the languages and file types [we support](https://docs.korbit.ai/configuration/supported-languages) and the [files we ignore](https://docs.korbit.ai/configuration/ignoring-files).

</details>





> Check out our [docs](https://docs.korbit.ai) on how you can make Korbit work best for you and your team.
>
> Loving Korbit!? Share us on [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https://www.korbit.ai&text=Korbit%20AI-powered%20Code%20Reviews%20are%20awesome...) [Reddit](https://www.reddit.com/submit?url=https://www.korbit.ai&title=Korbit%20AI-powered%20Code%20Reviews%20are%20awesome...) and [X](https://x.com/intent/tweet?text=Korbit%20AI-powered%20Code%20Reviews%20are%20awesome...%0A%0Ahttps%3A%2F%2Fwww.korbit.ai%0A%0A@KorbitAi)


state: COMMENTED
author_association: NONE
submitted_at: 2025-05-06T12:17:55Z
user: login: llamapreview[bot]
body: # Auto Pull Request Review from LlamaPReview

## 1. Overview

### 1.1 Core Changes
- **Primary purpose and scope**: Introduce an automated GitHub issue labeler tool that suggests urgency and importance labels for issues. This PR lays the foundation by adding the main script, prompt template, configuration, and initial documentation.
- **Key components modified**: Added `labeler.js` (main script), `prompt-template.txt` (prompt structure), `config.json` (configuration settings), `package.json` (project metadata and scripts), and `README.md` (documentation).
- **Cross-component impacts**: The main script (`labeler.js`) depends on the prompt template and configuration file. The `package.json` defines the entry point and execution script for the tool.
- **Business value alignment**: This PR aligns with the goal of automating issue triage, which helps in prioritizing work and removing bottlenecks. It sets the stage for future integration with the GitHub Models API.

### 1.2 Technical Architecture 
- **System design modifications**: Introduces a simple, standalone script that reads configuration and template files, prepares a prompt with dummy data, and simulates label suggestions.
- **Component interaction changes**: The main script interacts with the prompt template and configuration file to generate the prompt. Future versions will integrate with external APIs.
- **Integration points impact**: Currently, there are no external integrations. Future versions will need to handle API calls to fetch issues and interact with an LLM.
- **Dependency changes and implications**: Introduces dependencies on Node.js built-in modules (`fs` and `path`). No external libraries are used in this initial version.

## 2. Critical Findings

### 2.1 Must Fix (P0🔴)
**Issue**: Lack of error handling in file operations
- **Analysis Confidence**: High
- **Impact**: The script will crash if `config.json` or `prompt-template.txt` are missing or if `config.json` contains invalid JSON, leading to a poor user experience and potential data loss.
- **Resolution**: Implement `try...catch` blocks for file reading and JSON parsing. Use `path.join(__dirname, ...)` to construct robust, absolute file paths.

**Issue**: Fragile file paths
- **Analysis Confidence**: High
- **Impact**: The script may fail to locate its configuration and template files if executed from a directory other than the project root, leading to unreliable behavior.
- **Resolution**: Use `path.join(__dirname, ...)` to construct absolute paths for `config.json` and `prompt-template.txt`.

### 2.2 Should Fix (P1🟡)
**Issue**: Lack of automated tests
- **Analysis Confidence**: High
- **Impact**: Without tests, it's difficult to verify the correctness of the script, especially as logic is added in future versions. This increases the risk of introducing bugs.
- **Suggested Solution**: Introduce a basic test setup and add tests for file loading, prompt formatting, and future logic. Update the `package.json` test script to run these tests.

**Issue**: Naive string replacement for templating
- **Analysis Confidence**: Medium
- **Impact**: The simple `.replace()` method may fail if placeholder strings appear within the actual issue text, leading to incorrect prompt formatting and potentially inaccurate label suggestions.
- **Suggested Solution**: Consider using a global regex or a simple templating function for more robust placeholder replacement.

### 2.3 Consider (P2🟢)
**Area**: Synchronous I/O
- **Analysis Confidence**: Medium
- **Improvement Opportunity**: While acceptable for a simple CLI script, `fs.readFileSync` is blocking. Future versions might consider asynchronous I/O (`fs.promises.readFile`) if this script were to evolve into a service or handle many files concurrently.

**Area**: Code comments
- **Analysis Confidence**: Low
- **Improvement Opportunity**: Adding more comments in `labeler.js`, especially around the simulation part and where future API calls will go, would improve code clarity and maintainability.

### 2.4 Summary of Action Items
1. **Must Fix (P0)**:
   - Implement error handling for file operations in `labeler.js` (High priority, should be addressed before merging).
   - Use `path.join(__dirname, ...)` for robust file paths in `labeler.js` (High priority, should be addressed before merging).
2. **Should Fix (P1)**:
   - Add basic tests for file loading and prompt formatting (Medium priority, should be addressed in a follow-up PR).
   - Consider improving the templating approach for robustness (Medium priority, can be addressed in a follow-up PR).
3. **Consider (P2)**:
   - Evaluate the need for asynchronous I/O in future versions (Low priority, can be discussed during the next iteration).
   - Add more comments to `labeler.js` for better code clarity (Low priority, can be addressed in a follow-up PR).

## 3. Technical Analysis

### 3.1 Code Logic Analysis
📁 **labeler.js** - **Main Script**
  - Submitted PR Code:
```javascript
    const fs = require('fs');
    const path = require('path');

    const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
    const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));

    const issue = {
      title: "Enable automatic triage with GitHub models",
      body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
    };

    const prompt = promptTemplate
      .replace('{{title}}', issue.title)
      .replace('{{body}}', issue.body);

    console.log("=== Prompt Sent to Model ===");
    console.log(prompt);

    console.log("=== Suggested Labels ===");
    console.log("urgency: urgent");
    console.log("importance: high");
```
  - Analysis:
    * **Current logic and potential issues**: The script reads configuration and template files, prepares a prompt with dummy data, and prints the prompt and simulated labels. The main issues are the lack of error handling and fragile file paths.
    * **Edge cases and error handling**: The script does not handle errors during file reading or JSON parsing, which can lead to crashes. The use of relative paths can cause the script to fail if executed from a different directory.
    * **Cross-component impact**: The script depends on the prompt template and configuration file. Future versions will need to handle API calls and real issue data.
    * **Business logic considerations**: The core business logic is defined in the prompt template. The script simulates the label suggestion process, which will be replaced with real API calls in future versions.
  - LlamaPReview Suggested Improvements:
```javascript
    const fs = require('fs');
    const path = require('path');

    let promptTemplate;
    let config;

    try {
      const promptTemplatePath = path.join(__dirname, 'prompt-template.txt');
      promptTemplate = fs.readFileSync(promptTemplatePath, 'utf-8');

      const configPath = path.join(__dirname, 'config.json');
      const configFileContent = fs.readFileSync(configPath, 'utf-8');
      config = JSON.parse(configFileContent);

    } catch (error) {
      if (error.code === 'ENOENT') {
        console.error(`Error: Configuration file or prompt template not found. Make sure 'config.json' and 'prompt-template.txt' are in the script directory.`);
      } else if (error instanceof SyntaxError) {
        console.error(`Error: Failed to parse config.json. Check for invalid JSON syntax.`);
      } else {
        console.error(`An unexpected error occurred while loading files: ${error.message}`);
      }
      process.exit(1);
    }

    const issue = {
      title: "Enable automatic triage with GitHub models",
      body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
    };

    const prompt = promptTemplate
      .replace(/{{title}}/g, issue.title)
      .replace(/{{body}}/g, issue.body);

    console.log("=== Prompt Sent to Model ===");
    console.log(prompt);

    console.log("=== Suggested Labels ===");
    console.log("urgency: urgent");
    console.log("importance: high");
```
  - Improvement rationale:
    * **Technical benefits**: The script is more robust and reliable, with better error handling and file path management.
    * **Business value**: A more reliable tool foundation, reducing debugging time for setup issues.
    * **Risk assessment**: The risk of the script crashing due to missing files or invalid JSON is mitigated.

📁 **package.json** - **Project Metadata and Scripts**
  - Submitted PR Code:
```json
    {
      "name": "issue-labeler",
      "version": "1.0.0",
      "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
      "main": "labeler.js",
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "start": "node labeler.js"
      },
      "repository": {
        "type": "git",
        "url": "git+https://github.com/dmitriz/issue-labeler.git"
      },
      "keywords": [],
      "author": "",
      "license": "ISC",
      "bugs": {
        "url": "https://github.com/dmitriz/issue-labeler/issues"
      },
      "homepage": "https://github.com/dmitriz/issue-labeler#readme"
    }
```
  - Analysis:
    * **Current logic and potential issues**: The `package.json` file defines the project metadata and scripts. The main issue is the placeholder test script that always fails.
    * **Edge cases and error handling**: Not applicable.
    * **Cross-component impact**: The `package.json` defines the entry point and execution script for the tool.
    * **Business logic considerations**: Not applicable.
  - LlamaPReview Suggested Improvements:
```json
    {
      "name": "issue-labeler",
      "version": "1.0.0",
      "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
      "main": "labeler.js",
      "scripts": {
        "test": "node --test", // Example using Node.js built-in test runner
        "start": "node labeler.js"
      },
      "repository": {
        "type": "git",
        "url": "git+https://github.com/dmitriz/issue-labeler.git"
      },
      "keywords": [],
      "author": "",
      "license": "ISC",
      "bugs": {
        "url": "https://github.com/dmitriz/issue-labeler/issues"
      },
      "homepage": "https://github.com/dmitriz/issue-labeler#readme"
    }
```
  - Improvement rationale:
    * **Technical benefits**: The test script is updated to run actual tests, improving code reliability and maintainability.
    * **Business value**: Reduces bugs and increases confidence in code changes.
    * **Risk assessment**: The risk of undetected bugs is mitigated by introducing automated tests.

### 3.2 Key Quality Aspects 
- **System scalability considerations**: Not applicable to this version. Future versions may need to consider scalability when handling real issue data and API calls.
- **Performance bottlenecks and optimizations**: The current script is simple and performs minimal operations, so performance is not a concern. Future versions may need to consider asynchronous I/O for better performance.
- **Testing strategy and coverage**: The lack of tests is a significant issue. Introducing a basic test setup and adding tests for file loading and prompt formatting would improve code reliability and maintainability.
- **Documentation needs**: The `README.md` provides good basic usage instructions for this initial version. Future versions may need to include more detailed documentation, especially for configuration and API integration.

## 4. Overall Evaluation
- **Technical assessment**: The PR introduces a good starting point for the Issue Labeler tool. The main script is simple and demonstrates the intended workflow. However, the lack of error handling and fragile file paths are critical issues that need to be addressed.
- **Business impact**: The PR aligns with the goal of automating issue triage, which helps in prioritizing work and removing bottlenecks. It sets the stage for future integration with the GitHub Models API.
- **Risk evaluation**: The main risks are the lack of error handling and fragile file paths, which can lead to script crashes and unreliable behavior. These issues should be addressed before merging.
- **Notable positive aspects and good practices**: The PR provides clear documentation, configuration, and a working script for initial testing and demonstration. The prompt template is well-defined and serves as a good starting point for the LLM integration.
- **Implementation quality**: The implementation is simple and straightforward, but it lacks robustness due to the absence of error handling and tests. The code is easy to read and understand, but more comments would improve clarity.
- **Final recommendation**: Approve this PR after addressing the P0 issues (error handling and robust file paths). The P1 and P2 issues can be addressed in follow-up PRs, but adding tests early is highly recommended to build a solid foundation. This PR provides a clear path forward for integrating the real LLM functionality.

---
💡 **LlamaPReview Community**
Have feedback on this AI Code review tool? Join our [GitHub Discussions](https://github.com/JetXu-LLM/LlamaPReview-site/discussions) to share your thoughts and help shape the future of LlamaPReview.
state: COMMENTED
author_association: NONE
submitted_at: 2025-05-06T12:19:18Z
user: login: dmitriz
state: COMMENTED
author_association: OWNER
submitted_at: 2025-05-06T12:20:24Z
user: login: gemini-code-assist[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:20:29Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 7**

<details>
<summary>🧹 Nitpick comments (1)</summary><blockquote>

<details>
<summary>README.md (1)</summary><blockquote>

`1-4`: **Description is concise but could be more informative.**

The README provides a basic description of the tool's purpose but could benefit from more context about the problem it solves.

Consider expanding the description to include:
- Why automatic issue labeling is valuable
- How the tool fits into a GitHub workflow
- What specific problems it addresses (e.g., bottlenecks in manual triage)

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between ab8bf71f5aeb0c89622ca50ca1d8d73e078dbfa6 and 3e5d2b7a3139c9919d10b4f193302434a5be17b5.

</details>

<details>
<summary>📒 Files selected for processing (5)</summary>

* `README.md` (1 hunks)
* `config.json` (1 hunks)
* `labeler.js` (1 hunks)
* `package.json` (1 hunks)
* `prompt-template.txt` (1 hunks)

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (1)</summary>

* GitHub Check: pixeebot[bot]

</details>

<details>
<summary>🔇 Additional comments (4)</summary><blockquote>

<details>
<summary>config.json (1)</summary>

`1-4`: <details>
<summary>❓ Verification inconclusive</summary>

**Configuration looks appropriate for label classification.**

The configuration sets up a high-capability model (gpt-4) with a low temperature (0.3), which is suitable for deterministic classification tasks like issue labeling.


Consider whether this configuration needs to be extended with:
- `max_tokens` parameter to limit response size
- API credentials placeholders

---

🏁 Script executed:

```shell
#!/bin/bash
# Check if similar AI labeling tools commonly use additional configuration parameters
rg -g "*.json" "temperature" --no-ignore
```

Length of output: 73

---

🏁 Script executed:

```shell
#!/bin/bash
# Search for max_tokens references in the codebase
rg -i "max_tokens" --no-ignore

# Search for API credential usages (e.g., OPENAI_API_KEY)
rg -i "OPENAI_API_KEY" --no-ignore
```

Length of output: 65

---



</details>

**Verify max_tokens and credential handling**

The repository search returned no references to `max_tokens` or `OPENAI_API_KEY`:
- No `max_tokens` in JSON or code → default token limit may apply.
- No `OPENAI_API_KEY` references → credentials loading isn’t apparent.

Please confirm:
- Whether you rely on the API’s default max_tokens or should explicitly set it in `config.json`.
- How and where API credentials are provided (e.g., env vars, a separate config file).

</details>
<details>
<summary>prompt-template.txt (2)</summary>

`8-9`: **Output format is well-defined.**

The YAML block format is appropriate for structured output and aligns with the intended use case.

---

`11-15`: **Placeholder format is consistent with implementation.**

The template's placeholders ({{title}} and {{body}}) match those used in the labeler.js implementation.

</details>
<details>
<summary>labeler.js (1)</summary>

`16-19`: **Template replacement is simplistic but effective.**

The current approach for placeholder replacement works for the simple case but may need enhancement for more complex templates.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:21:02Z
user: login: codeant-ai[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:21:20Z
user: login: codiumai-pr-agent-free[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:22:19Z
user: login: qodo-code-review[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:22:19Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 3**

<details>
<summary>♻️ Duplicate comments (8)</summary><blockquote>

<details>
<summary>prompt-template.txt (1)</summary><blockquote>

`1-5`: **Prompt instructions are clear but lack decision criteria.**

The prompt clearly defines the assistant's role and required outputs, but doesn't provide criteria for determining what makes an issue "urgent" vs "not urgent" or "high" vs "low" importance.


Consider adding criteria guidelines to improve consistency:

```diff
 You are a GitHub issue triage assistant. Read the issue and assign:

 1. **urgency**: Is this urgent or not urgent?
 2. **importance**: Is this high or low importance?
+
+For urgency, consider:
+- "urgent": Issues blocking critical functionality or affecting many users
+- "not urgent": Issues that can be addressed in regular development cycles
+
+For importance, consider:
+- "high": Issues impacting core functionality or user experience
+- "low": Nice-to-have improvements or minor bugs with workarounds
```

</blockquote></details>
<details>
<summary>README.md (1)</summary><blockquote>

`5-20`: _🛠️ Refactor suggestion_

**Usage instructions are accurate but minimal.**

The instructions match the available methods to run the tool but lack information about configuration options and input/output details.



Consider expanding the documentation with configuration and customization sections:

```diff
 ## Usage
 
 First, install the dependencies:
 
 ```bash
 npm install
 ```
 
 ```bash
 # Directly with Node.js
 node labeler.js
 
 # Using NPM script
 npm start
 ```
+
+## Configuration
+
+Modify `config.json` to adjust model parameters:
+- `model`: The AI model to use (default: "gpt-4")
+- `temperature`: Controls randomness (0.0-1.0, default: 0.3)
+
+## Input Format
+
+Currently, the tool uses example data in the script. Future versions will accept:
+- GitHub issue URLs
+- JSON input via command line
```

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

7-7: Multiple headings with the same content
null

(MD024, no-duplicate-heading)

</details>

</details>

</blockquote></details>
<details>
<summary>labeler.js (6)</summary><blockquote>

`1-2`: **Non-informative header comment.**

The current comment merely restates what the script does without providing contextual information about dependencies or integration points.



```diff
-// Main script: fetches issue content and generates urgency/importance labels
+// Automated issue labeling system that analyzes issue content to reduce manual triage effort
+// Dependencies: prompt-template.txt, config.json
```

---

`7-8`: **Hardcoded file paths.**

File paths are hardcoded as string literals, making the code less maintainable if file locations change.



```diff
+const PATHS = {
+  PROMPT_TEMPLATE: path.join(__dirname, 'prompt-template.txt'),
+  CONFIG: path.join(__dirname, 'config.json')
+};
+
 // Load the prompt template and config
-const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
-const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+const promptTemplate = fs.readFileSync(PATHS.PROMPT_TEMPLATE, 'utf-8');
+const config = JSON.parse(fs.readFileSync(PATHS.CONFIG, 'utf-8'));
```

---

`6-8`: _⚠️ Potential issue_

**Missing error handling for file operations.**

The script doesn't handle potential errors when reading files, which could cause unexpected crashes.



```diff
 // Load the prompt template and config
-const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
-const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+let promptTemplate, config;
+try {
+  promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+  config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+} catch (error) {
+  console.error('Error loading files:', error.message);
+  process.exit(1);
+}
```

---

`10-14`: _🛠️ Refactor suggestion_

**Unclear temporary implementation comment with hardcoded data.**

The comment doesn't explain why dummy data is being used or what will replace it in production.



```diff
-// Dummy issue data for now
+// TODO: Replace with GitHub API issue fetch. Currently using dummy data for development
 const issue = {
   title: "Enable automatic triage with GitHub models",
   body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
 };
```

Additionally, consider adding command-line argument support to allow passing real issue data:

```diff
-// TODO: Replace with GitHub API issue fetch. Currently using dummy data for development
-const issue = {
-  title: "Enable automatic triage with GitHub models",
-  body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
-};
+// Parse command line arguments or use dummy data if none provided
+const issue = (() => {
+  // Check if issue data is provided via command line
+  if (process.argv.length > 2) {
+    try {
+      return JSON.parse(process.argv[2]);
+    } catch (error) {
+      console.error('Error parsing issue data:', error.message);
+    }
+  }
+  
+  // Fall back to dummy data
+  return {
+    title: "Enable automatic triage with GitHub models",
+    body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
+  };
+})();
```

---

`16-19`: _⚠️ Potential issue_

**Missing Issue Property Validation.**

No validation of issue object properties before using them in string replacement can lead to 'undefined' strings in the prompt.



```diff
 // Replace placeholders in the template
+if (!issue.title || !issue.body) {
+  console.error('Invalid issue: missing required properties');
+  process.exit(1);
+}
+
 const prompt = promptTemplate
   .replace('{{title}}', issue.title)
   .replace('{{body}}', issue.body);
```

---

`25-28`: _🛠️ Refactor suggestion_

**Hardcoded response limits practical utility.**

The script simulates a model response with static values rather than making an actual API call.



As a follow-up step, implement actual model API integration:

```diff
-// Simulate model response (replace this with real API later)
-console.log("\n=== Suggested Labels ===\n");
-console.log("urgency: urgent");
-console.log("importance: high");
+// Function to call the model API
+async function callModelAPI(prompt, config) {
+  // This is a placeholder for actual API integration
+  console.log("\n=== Calling Model API ===\n");
+  
+  // In a real implementation, this would call OpenAI or GitHub Models API
+  // For now, we'll simulate a response after a delay
+  return new Promise(resolve => {
+    setTimeout(() => {
+      resolve({
+        urgency: Math.random() > 0.5 ? "urgent" : "not urgent",
+        importance: Math.random() > 0.5 ? "high" : "low"
+      });
+    }, 1000);
+  });
+}
+
+// Process the model's response
+async function main() {
+  try {
+    const response = await callModelAPI(prompt, config);
+    console.log("\n=== Suggested Labels ===\n");
+    console.log(`urgency: ${response.urgency}`);
+    console.log(`importance: ${response.importance}`);
+  } catch (error) {
+    console.error("Error calling model API:", error.message);
+  }
+}
+
+main();
```

</blockquote></details>

</blockquote></details>

<details>
<summary>🧹 Nitpick comments (4)</summary><blockquote>

<details>
<summary>config.json (1)</summary><blockquote>

`1-4`: **Configuration looks good but consider future extensibility.**

The configuration correctly specifies the model and temperature parameters for the labeling system. The low temperature value (0.3) is appropriate for deterministic labeling tasks.



Consider adding additional configuration options that will be useful as the tool evolves:

```diff
 {
   "model": "gpt-4",
-  "temperature": 0.3
+  "temperature": 0.3,
+  "maxTokens": 100,
+  "apiEndpoint": "https://api.example.com/v1"
 }
```

</blockquote></details>
<details>
<summary>package.json (3)</summary><blockquote>

`4-4`: **Remove future-tensed description**  
The `description` mentions planned extension (“will be extended”), which is atypical for package metadata. Consider shortening it to focus on current functionality.

---

`7-7`: **Replace placeholder test script**  
The `test` script is currently a no-op placeholder. Add a real test runner or remove it until actual tests are available.

---

`14-15`: **Populate keywords and author fields**  
Both `keywords` (currently empty) and `author` are unset. Adding relevant keywords (e.g., `["issue-labeler","github","automation"]`) and your name or organization improves discoverability.

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between ab8bf71f5aeb0c89622ca50ca1d8d73e078dbfa6 and b10f635964cdbe0862a03325155afed3681c2578.

</details>

<details>
<summary>📒 Files selected for processing (5)</summary>

* `README.md` (1 hunks)
* `config.json` (1 hunks)
* `labeler.js` (1 hunks)
* `package.json` (1 hunks)
* `prompt-template.txt` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

<details>
<summary>README.md</summary>

7-7: Multiple headings with the same content
null

(MD024, no-duplicate-heading)

</details>

</details>

</details>

<details>
<summary>🔇 Additional comments (11)</summary><blockquote>

<details>
<summary>prompt-template.txt (2)</summary>

`6-9`: **YAML output format is well-defined.**

The prompt clearly specifies the expected YAML output format, making it straightforward for the model to generate structured responses that can be easily parsed.

---

`11-15`: **Input format with placeholders is appropriately structured.**

The placeholders for issue title and body are correctly defined, allowing for dynamic insertion of issue content into the prompt.

</details>
<details>
<summary>README.md (1)</summary>

`1-4`: **Clear project description.**

The README provides a concise introduction to the purpose of the tool and mentions the plan to extend functionality with GitHub Models API.

</details>
<details>
<summary>labeler.js (2)</summary>

`3-5`: **Module imports are appropriate.**

The script correctly imports the required modules for file operations.

---

`21-24`: **Informative console logging.**

Good practice to output what would be sent to the model for debugging and transparency.

</details>
<details>
<summary>package.json (6)</summary>

`2-3`: **Validate package identity and version**  
`name` "issue-labeler" and `version` "1.0.0" follow npm conventions for a first stable release.

---

`5-5`: **Verify main entry point file**  
Ensure that `labeler.js` exists at the project root and exports the expected functionality.

---

`8-9`: **Align script commands with documentation**  
Confirm that the `start` command (`node labeler.js`) matches the usage instructions in `README.md`. If the docs reference a different script name (e.g., `label`), update one side to match.

---

`10-13`: **Repository metadata looks correct**  
The `repository` object points to the GitHub URL and uses the correct `git+https` format.

---

`16-16`: **Confirm license choice**  
The license is set to ISC; verify this aligns with your project’s intended terms.

---

`17-21`: **Bugs and homepage configuration verified**  
The `bugs.url` and `homepage` fields correctly point to the repository’s issue tracker and README.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:23:09Z
user: login: dmitriz
state: COMMENTED
author_association: OWNER
submitted_at: 2025-05-06T12:27:11Z
user: login: gemini-code-assist[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-06T12:27:17Z

Review comments:
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
path: labeler.js
user: login: gemini-code-assist[bot]
body: ![high](https://img.shields.io/badge/priority-high-orange)

Consider adding error handling here in case the file does not exist or cannot be read. This will prevent the application from crashing and provide more informative error messages.

```javascript
try {
  const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
} catch (error) {
  console.error("Failed to read prompt-template.txt:", error);
  process.exit(1); // Exit the process to prevent further execution
}
```
created_at: 2025-05-06T12:17:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
path: labeler.js
user: login: gemini-code-assist[bot]
body: ![high](https://img.shields.io/badge/priority-high-orange)

Consider adding error handling here in case the file does not exist or cannot be read. This will prevent the application from crashing and provide more informative error messages.

```javascript
try {
  const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
} catch (error) {
  console.error("Failed to read config.json:", error);
  process.exit(1); // Exit the process to prevent further execution
}
```
created_at: 2025-05-06T12:17:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+
+// Dummy issue data for now
+const issue = {
+  title: "Enable automatic triage with GitHub models",
+  body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
+};
path: labeler.js
user: login: gemini-code-assist[bot]
body: ![medium](https://img.shields.io/badge/priority-medium-yellow)

This is dummy data. When integrating with real data, consider adding validation to ensure the `title` and `body` properties exist and are of the expected type (string).

```javascript
const issue = {
  title: typeof data.title === 'string' ? data.title : 'Default Title',
  body: typeof data.body === 'string' ? data.body : 'Default Body'
};
```
created_at: 2025-05-06T12:17:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,15 @@
+# Issue Labeler
+
+This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.
+
+## Usage
+
+You can run the labeler in two ways:
path: README.md
user: login: gemini-code-assist[bot]
body: ![medium](https://img.shields.io/badge/priority-medium-yellow)

It would be helpful to include an `npm install` step before running the labeler, to ensure that all dependencies are installed.

```suggestion
## Usage

First, install the dependencies:

```bash
npm install
```

You can then run the labeler in two ways:
```
created_at: 2025-05-06T12:17:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+
+// Dummy issue data for now
+const issue = {
+  title: "Enable automatic triage with GitHub models",
+  body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
+};
+
+// Replace placeholders in the template
+const prompt = promptTemplate
+  .replace('{{title}}', issue.title)
+  .replace('{{body}}', issue.body);
path: labeler.js
user: login: korbit-ai[bot]
body: ### Missing Issue Property Validation <sub>![category Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>

<details>
  <summary>Tell me more</summary>

###### What is the issue?
No validation of issue object properties before using them in string replacement

###### Why this matters
If issue.title or issue.body are undefined, the replacements will result in 'undefined' strings in the prompt, leading to incorrect model input

###### Suggested change ∙ *Feature Preview*
Add validation before string replacement:
```javascript
if (!issue.title || !issue.body) {
  throw new Error('Invalid issue: missing required properties');
}

const prompt = promptTemplate
  .replace('{{title}}', issue.title)
  .replace('{{body}}', issue.body);
```


###### Provide feedback to improve future suggestions
[![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/4a2f771f-3a6c-48cb-962e-8c7c04b0215d/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/4a2f771f-3a6c-48cb-962e-8c7c04b0215d?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/4a2f771f-3a6c-48cb-962e-8c7c04b0215d?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/4a2f771f-3a6c-48cb-962e-8c7c04b0215d?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/4a2f771f-3a6c-48cb-962e-8c7c04b0215d)
</details>

<sub>

💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>

<!--- korbi internal id:55dc1a88-8775-47ca-90de-e95a879621f0 -->


[](55dc1a88-8775-47ca-90de-e95a879621f0)
created_at: 2025-05-06T12:17:55Z
author_association: NONE
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+
+// Dummy issue data for now
path: labeler.js
user: login: korbit-ai[bot]
body: ### Unclear temporary implementation comment <sub>![category Documentation](https://img.shields.io/badge/Documentation-7c3aed)</sub>

<details>
  <summary>Tell me more</summary>

###### What is the issue?
Comment doesn't explain why dummy data is being used or what will replace it in production.

###### Why this matters
Future developers won't know the intended data source or when this placeholder should be replaced.

###### Suggested change ∙ *Feature Preview*
// TODO: Replace with GitHub API issue fetch. Currently using dummy data for development


###### Provide feedback to improve future suggestions
[![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/ad7453fa-41c9-4b4f-a8bc-c3c92c9f841b/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/ad7453fa-41c9-4b4f-a8bc-c3c92c9f841b?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/ad7453fa-41c9-4b4f-a8bc-c3c92c9f841b?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/ad7453fa-41c9-4b4f-a8bc-c3c92c9f841b?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/ad7453fa-41c9-4b4f-a8bc-c3c92c9f841b)
</details>

<sub>

💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>

<!--- korbi internal id:b387c878-e340-48d5-a83b-248f2c537ee9 -->


[](b387c878-e340-48d5-a83b-248f2c537ee9)
created_at: 2025-05-06T12:17:55Z
author_association: NONE
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
path: labeler.js
user: login: korbit-ai[bot]
body: ### Non-informative header comment <sub>![category Documentation](https://img.shields.io/badge/Documentation-7c3aed)</sub>

<details>
  <summary>Tell me more</summary>

###### What is the issue?
Top-level comment is redundant as it just describes what the code does without explaining why or providing context.

###### Why this matters
Takes up space without adding value beyond what's obvious from the code and filename.

###### Suggested change ∙ *Feature Preview*
// Automated issue labeling system that analyzes issue content to reduce manual triage effort
// Dependencies: prompt-template.txt, config.json


###### Provide feedback to improve future suggestions
[![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/8a5e4623-c244-4538-8ea5-541b4a5ce3f1/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/8a5e4623-c244-4538-8ea5-541b4a5ce3f1?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/8a5e4623-c244-4538-8ea5-541b4a5ce3f1?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/8a5e4623-c244-4538-8ea5-541b4a5ce3f1?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/8a5e4623-c244-4538-8ea5-541b4a5ce3f1)
</details>

<sub>

💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>

<!--- korbi internal id:999275b8-83ba-4b23-a13a-6cff0aee6321 -->


[](999275b8-83ba-4b23-a13a-6cff0aee6321)
created_at: 2025-05-06T12:17:55Z
author_association: NONE
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
path: labeler.js
user: login: korbit-ai[bot]
body: ### Hardcoded file paths <sub>![category Readability](https://img.shields.io/badge/Readability-0284c7)</sub>

<details>
  <summary>Tell me more</summary>

###### What is the issue?
File paths are hardcoded as string literals, making the code less maintainable and prone to errors if file locations change.

###### Why this matters
If file paths need to be updated, developers would need to search through code to find all instances. Using path constants or configuration would centralize path management.

###### Suggested change ∙ *Feature Preview*
```javascript
const PATHS = {
  PROMPT_TEMPLATE: path.join(__dirname, 'prompt-template.txt'),
  CONFIG: path.join(__dirname, 'config.json')
};

const promptTemplate = fs.readFileSync(PATHS.PROMPT_TEMPLATE, 'utf-8');
const config = JSON.parse(fs.readFileSync(PATHS.CONFIG, 'utf-8'));
```


###### Provide feedback to improve future suggestions
[![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/e76f958c-8834-4fdc-b918-e8bfb88c242f/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/e76f958c-8834-4fdc-b918-e8bfb88c242f?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/e76f958c-8834-4fdc-b918-e8bfb88c242f?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/e76f958c-8834-4fdc-b918-e8bfb88c242f?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/e76f958c-8834-4fdc-b918-e8bfb88c242f)
</details>

<sub>

💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>

<!--- korbi internal id:77df432d-7f5c-4dfd-a027-db21c3f10d28 -->


[](77df432d-7f5c-4dfd-a027-db21c3f10d28)
created_at: 2025-05-06T12:17:55Z
author_association: NONE
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
path: labeler.js
user: login: korbit-ai[bot]
body: ### Missing File Read Error Handling <sub>![category Error Handling](https://img.shields.io/badge/Error%20Handling-ea580c)</sub>

<details>
  <summary>Tell me more</summary>

###### What is the issue?
Missing error handling for file read operations which could cause the application to crash if the files don't exist

###### Why this matters
If prompt-template.txt or config.json files are missing, the application will throw an unhandled exception and crash

###### Suggested change ∙ *Feature Preview*
Wrap file operations in try-catch blocks and provide appropriate error handling:
```javascript
let promptTemplate, config;
try {
  promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
  config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
} catch (error) {
  console.error('Error loading required files:', error.message);
  process.exit(1);
}
```


###### Provide feedback to improve future suggestions
[![Nice Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/24e3f3cc-2ba1-4440-92a5-6e152345d246/upvote) [![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/24e3f3cc-2ba1-4440-92a5-6e152345d246?what_not_true=true)  [![Not in Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/24e3f3cc-2ba1-4440-92a5-6e152345d246?what_out_of_scope=true) [![Not in coding standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/24e3f3cc-2ba1-4440-92a5-6e152345d246?what_not_in_standard=true) [![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/9edd23fc-12be-4bab-b20e-f5a30f0430ae/24e3f3cc-2ba1-4440-92a5-6e152345d246)
</details>

<sub>

💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>

<!--- korbi internal id:28a2626e-dbd8-4d0d-bd04-ce2779d0956a -->


[](28a2626e-dbd8-4d0d-bd04-ce2779d0956a)
created_at: 2025-05-06T12:17:55Z
author_association: NONE
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
path: labeler.js
user: login: dmitriz
body: /gemini commitable action pls

created_at: 2025-05-06T12:20:23Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
path: labeler.js
user: login: gemini-code-assist[bot]
body: Yes, I can provide a committable action for the error handling block. Here's the suggested code, which includes a try-catch block to handle potential errors when reading the `config.json` file. This will prevent the application from crashing if the file is missing or corrupted.


```suggestion
try {
  const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
} catch (error) {
  console.error("Failed to read config.json:", error);
  process.exit(1); // Exit the process to prevent further execution
}
```
created_at: 2025-05-06T12:20:29Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,15 @@
+You are a GitHub issue triage assistant. Read the issue and assign:
+
+1. **urgency**: Is this urgent or not urgent?
+2. **importance**: Is this high or low importance?
+
path: prompt-template.txt
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Prompt instructions are clear but lack decision criteria.**

The prompt clearly defines the assistant's role and required outputs, but doesn't provide criteria for determining what makes an issue "urgent" vs "not urgent" or "high" vs "low" importance.

Consider adding criteria guidelines to improve consistency:

```diff
 1. **urgency**: Is this urgent or not urgent?
 2. **importance**: Is this high or low importance?
+
+For urgency, consider:
+- "urgent": Issues blocking critical functionality or affecting many users
+- "not urgent": Issues that can be addressed in regular development cycles
+
+For importance, consider:
+- "high": Issues impacting core functionality or user experience
+- "low": Nice-to-have improvements or minor bugs with workarounds
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
You are a GitHub issue triage assistant. Read the issue and assign:

1. **urgency**: Is this urgent or not urgent?
2. **importance**: Is this high or low importance?

For urgency, consider:
- "urgent": Issues blocking critical functionality or affecting many users
- "not urgent": Issues that can be addressed in regular development cycles

For importance, consider:
- "high": Issues impacting core functionality or user experience
- "low": Nice-to-have improvements or minor bugs with workarounds
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In prompt-template.txt around lines 1 to 5, the prompt lacks specific criteria for determining urgency and importance of issues. Add clear guidelines or decision criteria that define what qualifies an issue as "urgent" versus "not urgent" and "high" versus "low" importance to ensure consistent and accurate triage by the assistant.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:21:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,15 @@
+# Issue Labeler
+
+This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.
+
+## Usage
+
+You can run the labeler in two ways:
+
+```bash
+# Directly with Node.js
+node labeler.js
+
+# Using NPM script
+npm run label
+```
path: README.md
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Usage instructions are accurate but minimal.**

The instructions match the available methods to run the tool but lack information about:
- Configuration options
- Input/output details
- Installation requirements


Consider adding:
```diff
 ## Usage
 
 You can run the labeler in two ways:
 
 ```bash
 # Directly with Node.js
 node labeler.js
 
 # Using NPM script
 npm run label
 ```
+
+## Installation
+
+```bash
+# Clone the repository
+git clone https://github.com/dmitriz/issue-labeler.git
+
+# Install dependencies (if any added in the future)
+npm install
+```
+
+## Configuration
+
+Modify `config.json` to adjust model parameters:
+- `model`: The AI model to use (default: "gpt-4")
+- `temperature`: Controls randomness (0.0-1.0, default: 0.3)
```

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In README.md around lines 5 to 15, the usage instructions are minimal and lack details on installation, configuration, and input/output. Add sections for Installation with commands to clone the repo and install dependencies, and Configuration explaining how to modify config.json with model parameters like model and temperature. This will provide users with comprehensive guidance on setup and customization.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:21:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,21 @@
+{
+  "name": "issue-labeler",
+  "version": "1.0.0",
+  "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
+  "main": "labeler.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "node labeler.js"
+  },
path: package.json
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Script naming inconsistency with README.**

The README refers to `npm run label` but package.json defines `npm run start`.

Align the script names to avoid confusion:

```diff
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
-  "start": "node labeler.js"
+  "label": "node labeler.js",
+  "start": "node labeler.js"
 },
```

This maintains backward compatibility while adding the command mentioned in the README.


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "label": "node labeler.js",
    "start": "node labeler.js"
  },
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In package.json around lines 6 to 9, the script name "start" is used but the README refers to "label". To fix this, add a new script named "label" with the same command as "start" (node labeler.js) to maintain backward compatibility and align with the README instructions.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:21:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,21 @@
+{
+  "name": "issue-labeler",
+  "version": "1.0.0",
+  "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
+  "main": "labeler.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "node labeler.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/dmitriz/issue-labeler.git"
+  },
+  "keywords": [],
+  "author": "",
+  "license": "ISC",
+  "bugs": {
+    "url": "https://github.com/dmitriz/issue-labeler/issues"
+  },
+  "homepage": "https://github.com/dmitriz/issue-labeler#readme"
+}
path: package.json
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Missing dependencies for API integration.**

The package.json doesn't list any dependencies that would be needed for GitHub API integration or LLM API calls.

Consider adding dependencies for the planned GitHub Models API integration:

```diff
 "homepage": "https://github.com/dmitriz/issue-labeler#readme",
+"dependencies": {
+  "@octokit/rest": "^19.0.0",
+  "dotenv": "^16.0.0"
+}
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
{
  "name": "issue-labeler",
  "version": "1.0.0",
  "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
  "main": "labeler.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node labeler.js"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/dmitriz/issue-labeler.git"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/dmitriz/issue-labeler/issues"
  },
  "homepage": "https://github.com/dmitriz/issue-labeler#readme",
  "dependencies": {
    "@octokit/rest": "^19.0.0",
    "dotenv": "^16.0.0"
  }
}
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In package.json lines 1 to 21, the file lacks dependencies required for GitHub API integration and LLM API calls. Add appropriate dependencies such as octokit for GitHub API and any necessary libraries for LLM interaction (e.g., axios or openai SDK) under the "dependencies" section to support the planned API integrations.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:21:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+
+// Dummy issue data for now
+const issue = {
+  title: "Enable automatic triage with GitHub models",
+  body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
+};
+
+// Replace placeholders in the template
+const prompt = promptTemplate
+  .replace('{{title}}', issue.title)
+  .replace('{{body}}', issue.body);
+
+// Output what would be sent to the model
+console.log("=== Prompt Sent to Model ===\n");
+console.log(prompt);
+
+// Simulate model response (replace this with real API later)
+console.log("\n=== Suggested Labels ===\n");
+console.log("urgency: urgent");
+console.log("importance: high");
path: labeler.js
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Hardcoded response limits practical utility.**

The script simulates a model response with static values rather than making an actual API call.

As a follow-up step, implement actual model API integration:

```diff
-// Simulate model response (replace this with real API later)
-console.log("\n=== Suggested Labels ===\n");
-console.log("urgency: urgent");
-console.log("importance: high");
+// Function to call the model API
+async function callModelAPI(prompt, config) {
+  // This is a placeholder for actual API integration
+  console.log("\n=== Calling Model API ===\n");
+  
+  // In a real implementation, this would call OpenAI or GitHub Models API
+  // For now, we'll simulate a response after a delay
+  return new Promise(resolve => {
+    setTimeout(() => {
+      resolve({
+        urgency: Math.random() > 0.5 ? "urgent" : "not urgent",
+        importance: Math.random() > 0.5 ? "high" : "low"
+      });
+    }, 1000);
+  });
+}
+
+// Process the model's response
+async function main() {
+  try {
+    const response = await callModelAPI(prompt, config);
+    console.log("\n=== Suggested Labels ===\n");
+    console.log(`urgency: ${response.urgency}`);
+    console.log(`importance: ${response.importance}`);
+  } catch (error) {
+    console.error("Error calling model API:", error.message);
+  }
+}
+
+main();
```


> Committable suggestion skipped: line range outside the PR's diff.

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In labeler.js around lines 25 to 28, the code currently outputs hardcoded model response values, which limits its practical use. Replace the static console.log statements with an actual API call to the model service, handle the asynchronous response properly, and then log the dynamic results. Ensure to manage errors and response parsing to integrate real model predictions instead of fixed values.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:21:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
path: labeler.js
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Missing error handling for file operations.**

The script doesn't handle potential errors when reading files, which could cause unexpected crashes.

Add try-catch blocks for file operations:

```diff
 // Load the prompt template and config
-const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
-const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+let promptTemplate, config;
+try {
+  promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+  config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+} catch (error) {
+  console.error('Error loading files:', error.message);
+  process.exit(1);
+}
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
// Load the prompt template and config
let promptTemplate, config;
try {
  promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
  config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
} catch (error) {
  console.error('Error loading files:', error.message);
  process.exit(1);
}
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In labeler.js around lines 6 to 8, the file reading operations lack error handling, which can cause the script to crash if files are missing or unreadable. Wrap the fs.readFileSync calls for 'prompt-template.txt' and 'config.json' inside try-catch blocks to catch and handle any errors gracefully, such as logging the error and exiting the process or providing fallback behavior.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:21:02Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+
+// Dummy issue data for now
+const issue = {
+  title: "Enable automatic triage with GitHub models",
+  body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
+};
path: labeler.js
user: login: coderabbitai[bot]
body: _🛠️ Refactor suggestion_

**Hardcoded dummy data limits functionality.**

The script uses hardcoded test data instead of accepting real issue data.

Consider implementing command-line argument support to allow passing issue data:

```diff
-// Dummy issue data for now
-const issue = {
-  title: "Enable automatic triage with GitHub models",
-  body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
-};
+// Parse command line arguments or use dummy data if none provided
+const issue = (() => {
+  // Check if issue data is provided via command line
+  if (process.argv.length > 2) {
+    try {
+      return JSON.parse(process.argv[2]);
+    } catch (error) {
+      console.error('Error parsing issue data:', error.message);
+    }
+  }
+  
+  // Fall back to dummy data
+  return {
+    title: "Enable automatic triage with GitHub models",
+    body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
+  };
+})();
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
// Parse command line arguments or use dummy data if none provided
const issue = (() => {
  // Check if issue data is provided via command line
  if (process.argv.length > 2) {
    try {
      return JSON.parse(process.argv[2]);
    } catch (error) {
      console.error('Error parsing issue data:', error.message);
    }
  }

  // Fall back to dummy data
  return {
    title: "Enable automatic triage with GitHub models",
    body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
  };
})();
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In labeler.js around lines 10 to 14, the issue data is currently hardcoded, limiting the script's usability. Modify the code to accept issue data via command-line arguments, parsing inputs such as title and body dynamically instead of using fixed dummy data. This will enable the script to process real issue information passed at runtime.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:21:02Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,21 @@
+{
+  "name": "issue-labeler",
+  "version": "1.0.0",
+  "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
+  "main": "labeler.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "node labeler.js"
+  },
path: package.json
user: login: codeant-ai[bot]
body: **Suggestion:** Add a "label" script to the npm scripts section for consistency with the documented usage in the README. [Consistency]
```suggestion
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node labeler.js",
    "label": "node labeler.js"
  },
```
created_at: 2025-05-06T12:21:20Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,21 @@
+{
+  "name": "issue-labeler",
+  "version": "1.0.0",
+  "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
+  "main": "labeler.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "node labeler.js"
+  },
path: package.json
user: login: codiumai-pr-agent-free[bot]
body: **Suggestion:** Fix missing script
```suggestion
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node labeler.js",
    "label": "node labeler.js"
  },
```

<!-- manually_applied -->
created_at: 2025-05-06T12:22:19Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,21 @@
+{
+  "name": "issue-labeler",
+  "version": "1.0.0",
+  "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
+  "main": "labeler.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "node labeler.js"
+  },
path: package.json
user: login: qodo-code-review[bot]
body: **Suggestion:** Fix missing script
```suggestion
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node labeler.js",
    "label": "node labeler.js"
  },
```

<!-- manually_applied -->
created_at: 2025-05-06T12:22:19Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,20 @@
+# Issue Labeler
+
+This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.
+
+## Usage
+
+## Usage
+
+First, install the dependencies:
+
+```bash
+npm install
+
+```bash
+# Directly with Node.js
+node labeler.js
+
+# Using NPM script
+npm run label
+```
path: README.md
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Malformed code block structure.**

The code block structure is incorrect - there's a nested code block which makes the formatting invalid.


Fix the code block formatting:

```diff
 ```bash
 npm install
-
-```bash
+```
+
+```bash
 # Directly with Node.js
 node labeler.js

 # Using NPM script
 npm run label
 ```
```

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In README.md around lines 11 to 20, the code block formatting is incorrect due to a nested code block. Fix this by closing the first bash code block after "npm install" with triple backticks, then start a new bash code block before the commands "node labeler.js" and "npm run label". This will ensure proper separation and valid markdown formatting.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:23:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,20 @@
+# Issue Labeler
+
+This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.
+
+## Usage
+
+## Usage
+
+First, install the dependencies:
+
+```bash
+npm install
+
+```bash
+# Directly with Node.js
+node labeler.js
+
+# Using NPM script
+npm run label
+```
path: README.md
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Inconsistent npm script name.**

The README references `npm run label` but according to the PR objectives summary, the script is named `start` in package.json.


```diff
 # Directly with Node.js
 node labeler.js

 # Using NPM script
-npm run label
+npm start
 ```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
# Directly with Node.js
node labeler.js

# Using NPM script
npm start
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In README.md around lines 15 to 20, the npm script name used is inconsistent with the package.json. The README currently references `npm run label`, but the correct script name according to package.json is `start`. Update the README to use `npm run start` instead of `npm run label` to ensure consistency and avoid confusion.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:23:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,20 @@
+# Issue Labeler
+
+This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.
+
+## Usage
+
+## Usage
path: README.md
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**Duplicated section heading.**

There are two identical "## Usage" headings, which violates markdown standards and creates confusion in the document structure.


```diff
 ## Usage
 
-## Usage
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
## Usage
`````

</details>

<!-- suggestion_end -->

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

7-7: Multiple headings with the same content
null

(MD024, no-duplicate-heading)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents (early access)</summary>

```
In README.md around lines 5 to 7, there are two identical "## Usage" section headings. Remove the duplicated "## Usage" heading to maintain proper markdown structure and avoid confusion in the document.
```

</details>

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-05-06T12:23:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
path: labeler.js
user: login: dmitriz
body: /gemini commitable action pls
created_at: 2025-05-06T12:27:11Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,28 @@
+// Main script: fetches issue content and generates urgency/importance labels
+
+const fs = require('fs');
+const path = require('path');
+
+// Load the prompt template and config
+const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
path: labeler.js
user: login: gemini-code-assist[bot]
body: OK. Here's a committable action for the error handling. I've included a comment in the catch block to explain why we're exiting the process.

```suggestion
try {
  const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
} catch (error) {
  console.error("Failed to read prompt-template.txt:", error);
  process.exit(1); // Exit the process to prevent further execution
}
```
created_at: 2025-05-06T12:27:17Z
author_association: CONTRIBUTOR

PR comments:
user: login: coderabbitai[bot]
created_at: 2025-05-06T12:17:18Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: rate limited by coderabbit.ai -->

> [!WARNING]
> ## Rate limit exceeded
> 
> @dmitriz has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait **0 minutes and 19 seconds** before requesting another review.
> 
> <details>
> <summary>⌛ How to resolve this issue?</summary>
> 
> After the wait time has elapsed, a review can be triggered using the `@coderabbitai review` command as a PR comment. Alternatively, push new commits to this PR.
> 
> We recommend that you space out your commits to avoid hitting the rate limit.
> 
> </details>
> 
> 
> <details>
> <summary>🚦 How do rate limits work?</summary>
> 
> CodeRabbit enforces hourly rate limits for each developer per organization.
> 
> Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
> 
> Please see our [FAQ](https://docs.coderabbit.ai/faq) for further information.
> 
> </details>
> 
> <details>
> <summary>📥 Commits</summary>
> 
> Reviewing files that changed from the base of the PR and between 58260e8937b95fe19e26bad6510e41230b8a6418 and d18da8fe67bb53ac14a87c2708ce9d656c6f85e3.
> 
> </details>
> 
> <details>
> <summary>📒 Files selected for processing (3)</summary>
> 
> * `README.md` (1 hunks)
> * `labeler.js` (1 hunks)
> * `package.json` (1 hunks)
> 
> </details>

<!-- end of auto-generated comment: rate limited by coderabbit.ai -->
<!-- walkthrough_start -->

<details>
<summary>📝 Walkthrough</summary>

## Summary by CodeRabbit

- **New Features**
  - Introduced an automatic GitHub issue labeler tool that suggests urgency and importance labels using a prompt-based script.
  - Added a sample script to process issue content and simulate label suggestions.
  - Provided a customizable prompt template for consistent label assignment.
  - Included configuration options for model selection and output randomness.

- **Documentation**
  - Added a README with setup instructions and tool overview.

- **Chores**
  - Added project metadata and npm scripts for easy installation and execution.
## Summary by CodeRabbit

- **New Features**
  - Introduced an automatic label suggestion tool for GitHub issues, focusing on urgency and importance labels.
  - Added a script to simulate label suggestions based on issue content.
  - Provided a customizable prompt template for issue triage.
  - Included configuration options for language model parameters.

- **Documentation**
  - Added a README with setup instructions and tool usage details.

- **Chores**
  - Added project metadata and scripts for running the tool.

## Walkthrough

New files were added to introduce an "Issue Labeler" tool for GitHub issues. These include a documentation README, a Node.js script for simulating label suggestions, a configuration file, a prompt template, and project metadata in `package.json`. The tool currently operates with static data and simulated output.

## Changes

| File(s)                     | Change Summary                                                                                      |
|-----------------------------|---------------------------------------------------------------------------------------------------|
| README.md                   | Added documentation describing the Issue Labeler tool, its usage, and future plans.               |
| config.json                 | Introduced configuration file specifying model type and temperature for language model use.       |
| labeler.js                  | Added script to simulate automatic labeling of GitHub issues using prompt templates and config.   |
| package.json                | Added Node.js project metadata, npm scripts, repository info, and entry point for the tool.       |
| prompt-template.txt         | Added template for language model prompts, defining label assignment instructions and placeholders.|

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant labeler.js
    participant prompt-template.txt
    participant config.json

    User->>labeler.js: Run script (via npm or Node)
    labeler.js->>prompt-template.txt: Read prompt template
    labeler.js->>config.json: Read configuration
    labeler.js->>labeler.js: Insert dummy issue data into template
    labeler.js->>User: Output generated prompt and simulated labels
```

## Poem

> 🏷️  
> New scripts and configs, a labeler’s delight,  
> Prompt templates ready, the README in sight.  
> Simulated labels, urgency and more,  
> With Node.js magic, automation’s at the core.  
> A project begins, with structure so neat—  
> GitHub issues, prepare for a treat!  
>

</details>

<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNxU3bABsvkCiQBHbGlcABpIcVwvOkgAIgBBWnp4DHV4NF94Zm5otgxcanh8LHwAM0gASUQHEkgAGRUSaL4CfC9Q2JR8ikVsBml0SHIAdxwCZmoY1t8lRHgicnoCe2wiUkRcSGwKUgwGeUxk7PwKAr3ar0avZFKTyABxdQAJbAEUauDEDRhYWumuhhebCzQaIBgUeDcTa4WDUSC7ZQ0ZCXARNFZrEJFDAyNCIGLFd41BT5djhPDwLzwABeKSIgyYGFK822KmiPB62WhJGylxo6Aw9GYijReNw4gwRC+RgA0iQDkk0sVkClAcCSBwjFB4pAJil7ODIZsABQAAxRTUoGiEiBNAEoIrDNlkctz2MgYbUmP5IKVsHtxMUMup5GV4WREbTCcFIObrt93MgwRCoTH8GhaMg0OyWCmaDzJvz6AymUQWQGMOFeCRuM4BlneDnNsN1LBILRHMx5EgibRqGhwod7FlvJNkVd0etyzc7ttdvtCyhjqdMP0NAYtdnORFuTkC0y2aaG5ywHndzQNLgAB64O0OuFKJnkd2/LqeTa3CgTd93D064XtAEgVoSNd36WA2iUChpz4bto0iNlBwERRZAHAV7G4UR4CZAZfxIS8MLEGIAE14gAWTqfg8DfH0Ti/Gi+FjKUoAAYWKEsyyxH0KQGBwGFbXFIBNYt5itRBihNCJ8HQzDSnkIUlF8GsqDYGgoJjeAAGs/hfeS0VwWQMIXU9EW2EhUPoE0awYDS0FIUTxMk7MJHgJQeDQazbNqFT0z7BcMG4Zh9WTXBEHCFUgMjTAhgC+wClOBQnDQj8/D9VIJQdC4rktddIAAEXwBhHHYQoCWwbheyRLpBJsABReJctImqNGYWgJJhOEG2c1yovwKQKGckhRlDX8qiJBpUWaSS2jJRBPK6DYKD6Kd6MgJCYTbeB/DESA8NEckCUHfzmDAARcRiXbCvLcyw3IKhfFLFyV1qAlwNGZZsDxDKpq8NcDAAeT6jIAJhVBbB2jBYXOZ9an8bh8DmAgXFW+VgPS38UjSDJFxdPICnLfhyiitA8BYSZkg+TKJsjaYBy8Yo6WbdbyH6apnHkYTSyofHB1oAqivyEqsGWBxuDh+L1GQD7PN+/RjHAKAyHoUNiYIYhwy5mImFYdguF4fhhFEcQpBkdnhSoVR1C0HRZZMKAE3efkxkIBENaLFhca4KhRgcJwkbkBRIJUNRNG0XQwEMOXTAMWr6sa5raA1WIk4MCxIHiCo1dusmVl9kNyj4zB1iMbURkgGOGqalquLZYYBPTJQlik3nCtxr7YlG6NxotChOmmeMX3Lxq22kA1UWh770EzLAVdJ8QGBjccHAxDZKBWx5cBeN5YOkcJbkKuZ0tKnYyHnQdnROM5+gXiavkqTZcaxZ84V/f5Coofx8i8eQPrrdSiFgXAwwSDzAAZuKEJ0zr0CTIaBcu5sSOTwjQJKfoxBYiDPpSAjNWy/nXpvSApF/zIHiFYCo/dahS1IPYQ2nFOouQGCkBaS1H6OQYQUHww8MIChPvAAYzksxHQXItIWL5/jAI9HwYCW0ojyCwZAAAcsKUS/AWiwB6KsfiWABHQKhL9cwlh4heFUoLd0UlfxKEBM4YxBMdr4QvviPgngBCUnnuwNI0gjAKPIGuJOsRNRRw5vZDAidk6p3TpnREMQfYTCRqGAuEp3EGBLoNYk7EuacX3LUISbERLWgcrCGQJAyDoCSJEgiWFZAgUsSpSg0FBiXAlNgOaukfp3yoSFL6zTHKxCIOAgALJ0QcHNTLj2MlzUybllIkFUo5AADBoAAzOEYYCA+LElwD0a4X0qAChYE+ZAw0dL/gAOT7KongMh1dPTFAKAw/gGAv4ZU+oAqSWlZBgAkBkaMNZNpT3oLzAYGB8BOj2EBWo/DBqUnIOgaEL5Fa6JTvowxEYlSOTMaIS4aSUWhjwmLGgSsHGvGceDSIPDEAeOKCQAwPi/FgCMLGS01pgm+NCRnF22cols2sXEouiShjJO0ZsM0WUKCiQkqgFI6zej9Ebj6dyFJ1AFhnl+eA89YyRlDLg14UYBinTxErYRwC+AMiQZoH4tQBV+BIOmTMYCuT5j5KUDkgwMkLiGZirAjqWCDAAFIAGU/pyMud8Comwf42thBQWgTAG5tg7F2Cm+sRDbWNdoNKdIszwTBWhJCtB5A0GvBci1sNLgsx4CWkg4EvCQWVAa21257W1FkejCmJyIjqAQtm5Cjk2V8nrByFMC1aT9w8P2p00MsC8AlVMUxL4GRiQQuPFI1F2pNnwN4egqIqH5EclmeppYmn/m+AAMTaHTZsaMEChS+hauYzARyVSzJ0/wiA4bYlqP7Sd+RIxL0nDERiK1ZwnwOGhc+y5ziotnUqNoJBC0GhTG/D+0i2z4ABUCnglAPyBUwPIfwWNiEVEYEDfZEjZAYDQMwFV180Q9s4qiWQxQliXqHHe3kWJ4WhKRe6kxX1zEYqsdi2xpx7E8EJZR1x4gElQDkckl1QqJoMptMUmNsjAU2NxcJxxRLxOkoANwoE2Cm25WYNiHAyBSoKMCV2WutZcq9DYWZ4hte2Vg8aajXU/e0tduBl0zqudiaD3jk7rijlZGydlclBKpSE/RrL1bso7Jy2JkMeVJNGJZdyYWYMRYki6/Jq1CnTxKTK38DYk2mpDcPR8OEXylcNjqKZPkCgrSzAopQSjQtzTI2wegsRt5gHpT3aFkA+pzAJAARg0HMuZZrh4Cs4iZyqVmX74DaE7ZVDAgbyB/SESWx89jAaOLip6VHNnJU1VvCmksD7pr/gAoBIDNhHnAbqyJcGwiYJbGWzA3HEGK3045H+X1zv4MIWnEhFzdRYHYEjOGEqHYvpkjw+gAk5Pd1FfGYYUktFvczN6B8KQ6BcBNEiG8SyVmtgQ+wB5Xm3xTx2u/O4bBWaUMHHhCWH31qlG0ECfw10TQmdOCaMnKrWxCPHqj5ooqLMpg+pGVrWXb42GrPDdQJwuyMlooLB24U1S0ErPgCV1MpJZmB7DFXiN5AAFUbB1G+AAIVWJa3FkU0LgTYDWSh1u6i47BdcKStCG7hEhRpI3QPnharNwjNXFznFkE+qgUUjkKi+uYtdVTKtwJ8DuK8zHkaffSQYFhJH7HEVGOWssNFFiuPWJxXY/FImnFia/RJslOVpOjFkx18LYkMASXrjEWRtXtreQqlmQ6MULW8csVOPTqna9Cfr5pyj0bajaYGFP/wtBAu+OC7SgwT3cAnh3LyGDV5OBReZTF8Jrsc7RLzowZLCTUt1tPCfy5QxyMxEsqOo/DaLzXgkjy1RCKX7y3x+FQFfwLFQFmHmEWGaweHDwuyJHWXSBZ2qCQDOHK2BUYTEHHlxDmBM23WWFw0Y1qG3gXHwNgIiExxO0QC4EA32wXFA0vhgxmwYPnFjEIywE3TEV+D4FiAYNwE6DuFiEBVDT2zCE6FkQNFUnSEqwJ2R2VEu1WjpmskjBkJVSxl9H9DQUpAwTuDQFKFKGoXSgmAwG/jxDUmSgEIkI6CYOUKsw224LBSSGfT1Sqn8FLAxWHikDpgCnYEYFkEBAGGsLEK2AkI0E6DgDIKXBYJOy4Pyx2hbFXliAQH/mEP4LPTsOWUoFqFSJAU6H8GMLUmWG3mVGyHcnFDpC9FqG0NQUDD0JDD4B/j4BxUoB4XOGuliDPUKJIGKO41SH6BPEIFhCkGxh6CkFxmIx1BSDuAEFWGQFkVzxsjUQFFvmiMom8zwHojogTzKWwkUMGBInIhUIKg0jWVTWpl+CeRoOwirXWJEWP0VT90AjVGQFAgrQghqRWmbRqFbUzQXBzRQkwXJ3QG9GWE3X3GiGSCwFzS600J8FkBLzTk4ysQrxfA3343KHnzxWUQby02b1JU1HkXMyNFLhdXrkVCwBUykhxI01ExcUJOkFtAvz8QjltnBiVkJhJmv2zi1g9j8DQG9gSz9lNkDgthDmtnDgMA5P5PUAAH0XJEB5T/ABogFaB5SBdNhZYZT5ZVoxsZlSgAA2eZAAVgAE4jTekGBaBUQZkAAOI0gAJjQBmXmXmSdNNLG1NNNMMLoHmSNPtLGwYE9IAHZ7Sw5DAOTTT7SnSjSZkSB7TzT5lQyBBzTTTjCxtzSSA4zTpaAjSvSEzekxsnT5kZkBB7S0ArSxsIydTZT3YFSlSVSSA1S6B5S/t9AgA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=dmitriz/issue-labeler&utm_content=1):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: CONTRIBUTOR
user: login: qodo-code-review[bot]
created_at: 2025-05-06T12:17:32Z
body: _Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account [here](https://app.qodo.ai/qodo-merge)._

## PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

<table>
<tr><td>⏱️&nbsp;<strong>Estimated effort to review</strong>: 2 🔵🔵⚪⚪⚪</td></tr>
<tr><td>🧪&nbsp;<strong>No relevant tests</strong></td></tr>
<tr><td>🔒&nbsp;<strong>No security concerns identified</strong></td></tr>
<tr><td>⚡&nbsp;<strong>Recommended focus areas for review</strong><br><br>

<details><summary><a href='https://github.com/dmitriz/issue-labeler/pull/1/files#diff-b43b9c70d1f69cd74170f2fa67b3aa6a7107c0767069f2270134385e0e5aebb8R7-R8'><strong>Error Handling</strong></a>

The script lacks error handling for file reading operations and doesn't validate the structure of loaded files before using them.
</summary>

```javascript
const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
```

</details>

<details><summary><a href='https://github.com/dmitriz/issue-labeler/pull/1/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R8-R8'><strong>Script Inconsistency</strong></a>

The README mentions running the tool with 'npm run label' but the package.json defines the script as 'npm start'.
</summary>

```json
  "start": "node labeler.js"
},
```

</details>

</td></tr>
</table>

author_association: CONTRIBUTOR
user: login: codiumai-pr-agent-free[bot]
created_at: 2025-05-06T12:17:32Z
body: ## PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

<table>
<tr><td>⏱️&nbsp;<strong>Estimated effort to review</strong>: 2 🔵🔵⚪⚪⚪</td></tr>
<tr><td>🧪&nbsp;<strong>No relevant tests</strong></td></tr>
<tr><td>🔒&nbsp;<strong>No security concerns identified</strong></td></tr>
<tr><td>⚡&nbsp;<strong>Recommended focus areas for review</strong><br><br>

<details><summary><a href='https://github.com/dmitriz/issue-labeler/pull/1/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R8-R8'><strong>Script Mismatch</strong></a>

The README mentions running the tool with 'npm run label' but the package.json defines 'npm start' instead. This inconsistency could confuse users.
</summary>

```json
  "start": "node labeler.js"
},
```

</details>

<details><summary><a href='https://github.com/dmitriz/issue-labeler/pull/1/files#diff-b43b9c70d1f69cd74170f2fa67b3aa6a7107c0767069f2270134385e0e5aebb8R7-R8'><strong>Error Handling</strong></a>

The script lacks error handling for file reading operations. If prompt-template.txt or config.json are missing or malformed, the application will crash without a helpful error message.
</summary>

```javascript
const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
```

</details>

</td></tr>
</table>

author_association: CONTRIBUTOR
user: login: codiumai-pr-agent-free[bot]
created_at: 2025-05-06T12:17:56Z
body: ## PR Code Suggestions ✨
<!-- 3e5d2b7 -->

Latest suggestions up to 3e5d2b7
Explore these optional code suggestions:

<table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td>
<td>



<details><summary>
Fix missing script
</summary>

___


**The README mentions running the tool with <code>npm run label</code> but this script is not <br>defined in package.json. Add the missing script to match the documentation.**

[package.json [6-9]](https://github.com/dmitriz/issue-labeler/pull/1/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R6-R9)

```diff
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
-  "start": "node labeler.js"
+  "start": "node labeler.js",
+  "label": "node labeler.js"
 },
```

`[Suggestion processed]`

<details><summary>Suggestion importance[1-10]: 7</summary>

__

Why: The suggestion correctly identifies that the `README.md` mentions an `npm run label` command, but the corresponding script is missing in `package.json`. Adding the `label` script as suggested improves consistency between documentation and the actual project setup, enhancing usability.


</details></details></td><td align=center>Medium

</td></tr>
<tr><td align="center" colspan="2">

- [ ] Update <!-- /improve --more_suggestions=true -->

</td><td></td></tr></tbody></table>

___

#### Previous suggestions
<details><summary>✅ Suggestions up to commit 3e5d2b7</summary>
<br><table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=2>General</td>
<td>



<details><summary>✅ 
Add error handling
</summary>

___

<details><summary><b>Suggestion Impact:</b></summary>The commit implemented error handling for the config.json file reading operation using a try-catch block, which was part of the suggestion. However, it only added error handling for the config file and not for the prompt template file.

code diff:

```diff
+try {
+  const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+} catch (error) {
+  console.error("Failed to read config.json:", error);
+  process.exit(1); // Exit the process to prevent further execution
+}
```

</details>


___


**The code reads files using relative paths without error handling. Add try-catch <br>blocks to handle potential file reading errors gracefully, which could occur if <br>files are missing or permissions are insufficient.**

[labeler.js [6-8]](https://github.com/dmitriz/issue-labeler/pull/1/files#diff-b43b9c70d1f69cd74170f2fa67b3aa6a7107c0767069f2270134385e0e5aebb8R6-R8)

```diff
 // Load the prompt template and config
-const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
-const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+let promptTemplate, config;
+try {
+  promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
+  config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
+} catch (error) {
+  console.error('Error loading required files:', error.message);
+  process.exit(1);
+}
```

 <!-- /improve --apply_suggestion=0 -->

<details><summary>Suggestion importance[1-10]: 7</summary>

__

Why: The suggestion correctly points out the lack of error handling for file read operations. Adding `try-catch` blocks for `fs.readFileSync` and `JSON.parse` makes the script more robust by gracefully handling cases where configuration files might be missing or corrupted.


</details></details></td><td align=center>Medium

</td></tr><tr><td>



<details><summary>Add missing npm script</summary>

___


**The README mentions running the tool with <code>npm run label</code> but this script is not <br>defined in package.json. Add the "label" script that matches the documentation <br>to ensure users can run the tool as described.**

[package.json [6-9]](https://github.com/dmitriz/issue-labeler/pull/1/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R6-R9)

```diff
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
-  "start": "node labeler.js"
+  "start": "node labeler.js",
+  "label": "node labeler.js"
 },
```

 <!-- /improve --apply_suggestion=1 -->

<details><summary>Suggestion importance[1-10]: 6</summary>

__

Why: The suggestion correctly identifies a discrepancy between the `README.md` documentation (which mentions `npm run label`) and the `package.json` scripts. Adding the `label` script improves user experience and ensures the documented command works as expected.


</details></details></td><td align=center>Low

</td></tr>
<tr><td align="center" colspan="2">

 <!-- /improve --more_suggestions=true -->

</td><td></td></tr></tbody></table>

</details>
author_association: CONTRIBUTOR
user: login: codeant-ai[bot]
created_at: 2025-05-06T12:18:33Z
body: ## Pull Request Feedback 🔍

<table>
<tr><td>🔒&nbsp;<strong>No security issues identified</strong></td></tr>
<tr><td>⚡&nbsp;<strong>Recommended areas for review</strong><br><br>

<a href='https://github.com/dmitriz/issue-labeler/pull/1/files#diff-b43b9c70d1f69cd74170f2fa67b3aa6a7107c0767069f2270134385e0e5aebb8R7-R8'><strong>Error Handling</strong></a><br>The script reads the prompt template and configuration files synchronously without any error handling. Consider wrapping the fs.readFileSync and JSON.parse calls in try/catch blocks to handle missing or unreadable files gracefully.

<a href='https://github.com/dmitriz/issue-labeler/pull/1/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R7-R7'><strong>Missing Tests</strong></a><br>The test script in package.json is a placeholder. It would be beneficial to add unit tests for the labeler functionality to ensure robustness as the tool evolves.

</td></tr>
</table>

author_association: CONTRIBUTOR
user: login: coderabbitai[bot]
created_at: 2025-05-06T12:21:03Z
body: > [!CAUTION]
> No docstrings were generated.
author_association: CONTRIBUTOR
user: login: dmitriz
created_at: 2025-05-06T12:28:04Z
body: > # Auto Pull Request Review from LlamaPReview
> ## 1. Overview
> ### 1.1 Core Changes
> * **Primary purpose and scope**: Introduce an automated GitHub issue labeler tool that suggests urgency and importance labels for issues. This PR lays the foundation by adding the main script, prompt template, configuration, and initial documentation.
> * **Key components modified**: Added `labeler.js` (main script), `prompt-template.txt` (prompt structure), `config.json` (configuration settings), `package.json` (project metadata and scripts), and `README.md` (documentation).
> * **Cross-component impacts**: The main script (`labeler.js`) depends on the prompt template and configuration file. The `package.json` defines the entry point and execution script for the tool.
> * **Business value alignment**: This PR aligns with the goal of automating issue triage, which helps in prioritizing work and removing bottlenecks. It sets the stage for future integration with the GitHub Models API.
> 
> ### 1.2 Technical Architecture
> * **System design modifications**: Introduces a simple, standalone script that reads configuration and template files, prepares a prompt with dummy data, and simulates label suggestions.
> * **Component interaction changes**: The main script interacts with the prompt template and configuration file to generate the prompt. Future versions will integrate with external APIs.
> * **Integration points impact**: Currently, there are no external integrations. Future versions will need to handle API calls to fetch issues and interact with an LLM.
> * **Dependency changes and implications**: Introduces dependencies on Node.js built-in modules (`fs` and `path`). No external libraries are used in this initial version.
> 
> ## 2. Critical Findings
> ### 2.1 Must Fix (P0🔴)
> **Issue**: Lack of error handling in file operations
> 
> * **Analysis Confidence**: High
> * **Impact**: The script will crash if `config.json` or `prompt-template.txt` are missing or if `config.json` contains invalid JSON, leading to a poor user experience and potential data loss.
> * **Resolution**: Implement `try...catch` blocks for file reading and JSON parsing. Use `path.join(__dirname, ...)` to construct robust, absolute file paths.
> 
> **Issue**: Fragile file paths
> 
> * **Analysis Confidence**: High
> * **Impact**: The script may fail to locate its configuration and template files if executed from a directory other than the project root, leading to unreliable behavior.
> * **Resolution**: Use `path.join(__dirname, ...)` to construct absolute paths for `config.json` and `prompt-template.txt`.
> 
> ### 2.2 Should Fix (P1🟡)
> **Issue**: Lack of automated tests
> 
> * **Analysis Confidence**: High
> * **Impact**: Without tests, it's difficult to verify the correctness of the script, especially as logic is added in future versions. This increases the risk of introducing bugs.
> * **Suggested Solution**: Introduce a basic test setup and add tests for file loading, prompt formatting, and future logic. Update the `package.json` test script to run these tests.
> 
> **Issue**: Naive string replacement for templating
> 
> * **Analysis Confidence**: Medium
> * **Impact**: The simple `.replace()` method may fail if placeholder strings appear within the actual issue text, leading to incorrect prompt formatting and potentially inaccurate label suggestions.
> * **Suggested Solution**: Consider using a global regex or a simple templating function for more robust placeholder replacement.
> 
> ### 2.3 Consider (P2🟢)
> **Area**: Synchronous I/O
> 
> * **Analysis Confidence**: Medium
> * **Improvement Opportunity**: While acceptable for a simple CLI script, `fs.readFileSync` is blocking. Future versions might consider asynchronous I/O (`fs.promises.readFile`) if this script were to evolve into a service or handle many files concurrently.
> 
> **Area**: Code comments
> 
> * **Analysis Confidence**: Low
> * **Improvement Opportunity**: Adding more comments in `labeler.js`, especially around the simulation part and where future API calls will go, would improve code clarity and maintainability.
> 
> ### 2.4 Summary of Action Items
> 1. **Must Fix (P0)**:
>    
>    * Implement error handling for file operations in `labeler.js` (High priority, should be addressed before merging).
>    * Use `path.join(__dirname, ...)` for robust file paths in `labeler.js` (High priority, should be addressed before merging).
> 2. **Should Fix (P1)**:
>    
>    * Add basic tests for file loading and prompt formatting (Medium priority, should be addressed in a follow-up PR).
>    * Consider improving the templating approach for robustness (Medium priority, can be addressed in a follow-up PR).
> 3. **Consider (P2)**:
>    
>    * Evaluate the need for asynchronous I/O in future versions (Low priority, can be discussed during the next iteration).
>    * Add more comments to `labeler.js` for better code clarity (Low priority, can be addressed in a follow-up PR).
> 
> ## 3. Technical Analysis
> ### 3.1 Code Logic Analysis
> 📁 **labeler.js** - **Main Script**
> 
> * Submitted PR Code:
> 
> ```js
>     const fs = require('fs');
>     const path = require('path');
> 
>     const promptTemplate = fs.readFileSync('prompt-template.txt', 'utf-8');
>     const config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
> 
>     const issue = {
>       title: "Enable automatic triage with GitHub models",
>       body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
>     };
> 
>     const prompt = promptTemplate
>       .replace('{{title}}', issue.title)
>       .replace('{{body}}', issue.body);
> 
>     console.log("=== Prompt Sent to Model ===");
>     console.log(prompt);
> 
>     console.log("=== Suggested Labels ===");
>     console.log("urgency: urgent");
>     console.log("importance: high");
> ```
> 
> * Analysis:
>   
>   * **Current logic and potential issues**: The script reads configuration and template files, prepares a prompt with dummy data, and prints the prompt and simulated labels. The main issues are the lack of error handling and fragile file paths.
>   * **Edge cases and error handling**: The script does not handle errors during file reading or JSON parsing, which can lead to crashes. The use of relative paths can cause the script to fail if executed from a different directory.
>   * **Cross-component impact**: The script depends on the prompt template and configuration file. Future versions will need to handle API calls and real issue data.
>   * **Business logic considerations**: The core business logic is defined in the prompt template. The script simulates the label suggestion process, which will be replaced with real API calls in future versions.
> * LlamaPReview Suggested Improvements:
> 
> ```js
>     const fs = require('fs');
>     const path = require('path');
> 
>     let promptTemplate;
>     let config;
> 
>     try {
>       const promptTemplatePath = path.join(__dirname, 'prompt-template.txt');
>       promptTemplate = fs.readFileSync(promptTemplatePath, 'utf-8');
> 
>       const configPath = path.join(__dirname, 'config.json');
>       const configFileContent = fs.readFileSync(configPath, 'utf-8');
>       config = JSON.parse(configFileContent);
> 
>     } catch (error) {
>       if (error.code === 'ENOENT') {
>         console.error(`Error: Configuration file or prompt template not found. Make sure 'config.json' and 'prompt-template.txt' are in the script directory.`);
>       } else if (error instanceof SyntaxError) {
>         console.error(`Error: Failed to parse config.json. Check for invalid JSON syntax.`);
>       } else {
>         console.error(`An unexpected error occurred while loading files: ${error.message}`);
>       }
>       process.exit(1);
>     }
> 
>     const issue = {
>       title: "Enable automatic triage with GitHub models",
>       body: "We want to assign urgency and importance labels automatically to issues based on content. This will help prioritize work and remove bottlenecks."
>     };
> 
>     const prompt = promptTemplate
>       .replace(/{{title}}/g, issue.title)
>       .replace(/{{body}}/g, issue.body);
> 
>     console.log("=== Prompt Sent to Model ===");
>     console.log(prompt);
> 
>     console.log("=== Suggested Labels ===");
>     console.log("urgency: urgent");
>     console.log("importance: high");
> ```
> 
> * Improvement rationale:
>   
>   * **Technical benefits**: The script is more robust and reliable, with better error handling and file path management.
>   * **Business value**: A more reliable tool foundation, reducing debugging time for setup issues.
>   * **Risk assessment**: The risk of the script crashing due to missing files or invalid JSON is mitigated.
> 
> 📁 **package.json** - **Project Metadata and Scripts**
> 
> * Submitted PR Code:
> 
> ```json
>     {
>       "name": "issue-labeler",
>       "version": "1.0.0",
>       "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
>       "main": "labeler.js",
>       "scripts": {
>         "test": "echo \"Error: no test specified\" && exit 1",
>         "start": "node labeler.js"
>       },
>       "repository": {
>         "type": "git",
>         "url": "git+https://github.com/dmitriz/issue-labeler.git"
>       },
>       "keywords": [],
>       "author": "",
>       "license": "ISC",
>       "bugs": {
>         "url": "https://github.com/dmitriz/issue-labeler/issues"
>       },
>       "homepage": "https://github.com/dmitriz/issue-labeler#readme"
>     }
> ```
> 
> * Analysis:
>   
>   * **Current logic and potential issues**: The `package.json` file defines the project metadata and scripts. The main issue is the placeholder test script that always fails.
>   * **Edge cases and error handling**: Not applicable.
>   * **Cross-component impact**: The `package.json` defines the entry point and execution script for the tool.
>   * **Business logic considerations**: Not applicable.
> * LlamaPReview Suggested Improvements:
> 
> ```json
>     {
>       "name": "issue-labeler",
>       "version": "1.0.0",
>       "description": "This tool automatically suggests urgency and importance labels for GitHub issues using a lightweight prompt-based script. It will be extended to use GitHub Models API.",
>       "main": "labeler.js",
>       "scripts": {
>         "test": "node --test", // Example using Node.js built-in test runner
>         "start": "node labeler.js"
>       },
>       "repository": {
>         "type": "git",
>         "url": "git+https://github.com/dmitriz/issue-labeler.git"
>       },
>       "keywords": [],
>       "author": "",
>       "license": "ISC",
>       "bugs": {
>         "url": "https://github.com/dmitriz/issue-labeler/issues"
>       },
>       "homepage": "https://github.com/dmitriz/issue-labeler#readme"
>     }
> ```
> 
> * Improvement rationale:
>   
>   * **Technical benefits**: The test script is updated to run actual tests, improving code reliability and maintainability.
>   * **Business value**: Reduces bugs and increases confidence in code changes.
>   * **Risk assessment**: The risk of undetected bugs is mitigated by introducing automated tests.
> 
> ### 3.2 Key Quality Aspects
> * **System scalability considerations**: Not applicable to this version. Future versions may need to consider scalability when handling real issue data and API calls.
> * **Performance bottlenecks and optimizations**: The current script is simple and performs minimal operations, so performance is not a concern. Future versions may need to consider asynchronous I/O for better performance.
> * **Testing strategy and coverage**: The lack of tests is a significant issue. Introducing a basic test setup and adding tests for file loading and prompt formatting would improve code reliability and maintainability.
> * **Documentation needs**: The `README.md` provides good basic usage instructions for this initial version. Future versions may need to include more detailed documentation, especially for configuration and API integration.
> 
> ## 4. Overall Evaluation
> * **Technical assessment**: The PR introduces a good starting point for the Issue Labeler tool. The main script is simple and demonstrates the intended workflow. However, the lack of error handling and fragile file paths are critical issues that need to be addressed.
> * **Business impact**: The PR aligns with the goal of automating issue triage, which helps in prioritizing work and removing bottlenecks. It sets the stage for future integration with the GitHub Models API.
> * **Risk evaluation**: The main risks are the lack of error handling and fragile file paths, which can lead to script crashes and unreliable behavior. These issues should be addressed before merging.
> * **Notable positive aspects and good practices**: The PR provides clear documentation, configuration, and a working script for initial testing and demonstration. The prompt template is well-defined and serves as a good starting point for the LLM integration.
> * **Implementation quality**: The implementation is simple and straightforward, but it lacks robustness due to the absence of error handling and tests. The code is easy to read and understand, but more comments would improve clarity.
> * **Final recommendation**: Approve this PR after addressing the P0 issues (error handling and robust file paths). The P1 and P2 issues can be addressed in follow-up PRs, but adding tests early is highly recommended to build a solid foundation. This PR provides a clear path forward for integrating the real LLM functionality.
> 
> 💡 **LlamaPReview Community** Have feedback on this AI Code review tool? Join our [GitHub Discussions](https://github.com/JetXu-LLM/LlamaPReview-site/discussions) to share your thoughts and help shape the future of LlamaPReview.

/gemini commitable action pls
author_association: OWNER
user: login: gemini-code-assist[bot]
created_at: 2025-05-06T12:28:11Z
body: It looks like you're asking me to perform a `/gemini commitable action pls` command. However, I am not able to perform any actions at this time. I am only capable of responding to comments and providing code suggestions as part of that response.

If you were intending to invoke a command, please see the help message for the correct way to do that:

<details>

<summary><b>Using Gemini Code Assist</b></summary>
<br>

The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.

<b>Invoking Gemini</b>

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands.

Feature | Command | Description
--- | --- | ---
Code Review | `/gemini review` | Performs a code review for the current pull request in its current state.
Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state.
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments.
Help | `/gemini help` | Displays a list of available commands.

<b>Customization</b>

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).

<b>Limitations & Feedback</b>

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments to provide feedback.

</details>
author_association: CONTRIBUTOR