Skip to content

Develop#10

Open
ThiruNithish28 wants to merge 6 commits intomainfrom
develop
Open

Develop#10
ThiruNithish28 wants to merge 6 commits intomainfrom
develop

Conversation

@ThiruNithish28
Copy link
Copy Markdown
Owner

@ThiruNithish28 ThiruNithish28 commented May 4, 2026

Summary by CodeRabbit

New Features

  • Interactive dual-mode CLI supporting questionary prompts or flag-based command execution
  • Configuration management with auditgen config setup command
  • Windows EXE executable packaging via automated release workflow
  • Input validation with friendly error messages
  • Path traversal protection on ticket identifiers
  • Graceful Ctrl+C handling across all interactive prompts

Documentation

  • Updated README with installation, configuration, and usage examples
  • Added CHANGELOG documenting v0.1.0 release features

* initial setup for basi cli

* fix issue in basi cli
* change desing of CLI

* fix: address CodeRabbit review comments

* fix: check brd file is docx in the flag option

* fix: output path issue
* feat: add windows exe build pipeline and fix bundled template path

* fix: get_base_path method
* release: merge develop into main (CLI + UX + Windows exe support) (#4)

* developed cli for auditgen  (#1)

* initial setup for basi cli

* fix issue in basi cli

* feat: improve CLI UX, prompts, and generate workflow

* change desing of CLI

* fix: address CodeRabbit review comments

* fix: check brd file is docx in the flag option

* fix: output path issue

* feat: add windows exe build pipeline and fix bundled template path (#3)

* feat: add windows exe build pipeline and fix bundled template path

* fix: get_base_path method

* fix: resolve exe crash due to lazy import handling (#5)

* fix: lazy import not catch by PyInstaller

* fix: add debug in the cli to check what issue it crash (#6)
* release: merge develop into main (CLI + UX + Windows exe support) (#4)

* developed cli for auditgen  (#1)

* initial setup for basi cli

* fix issue in basi cli

* feat: improve CLI UX, prompts, and generate workflow

* change desing of CLI

* fix: address CodeRabbit review comments

* fix: check brd file is docx in the flag option

* fix: output path issue

* feat: add windows exe build pipeline and fix bundled template path (#3)

* feat: add windows exe build pipeline and fix bundled template path

* fix: get_base_path method

* fix: resolve exe crash due to lazy import handling (#5)

* fix: lazy import not catch by PyInstaller

* fix: add debug in the cli to check what issue it crash (#6)
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

📝 Walkthrough

Walkthrough

This PR introduces a complete CLI application framework for AudiGen with persistent configuration management, interactive prompts, input validation, and GitHub Actions CI/CD to build and release a Windows executable. It adds configuration persistence, user-interactive generation workflows, and infrastructure to distribute the tool as a standalone Windows binary.

Changes

AudiGen CLI with CI/CD Distribution

Layer / File(s) Summary
Configuration Foundation
audigen_cli/config.py
Persistent configuration stored in ~/.auditgen/config.json with functions to load, save, and update individual keys (API key, default user/approver, output directory).
Core CLI Implementation
audigen_cli/cli.py
Root click command group with config subcommand (setup/show) and generate command; orchestrates BRD extraction, API key setup, LLM call, and Excel generation; includes interactive prompts for missing arguments, validation, and centralized Ctrl+C/crash handling.
UI & Validation
audigen_cli/banner.py, audigen_cli/ui.py, audigen_cli/utils.py
Banner rendering (ASCII art + styled panel), questionary color scheme definition, and date/path validation (DATE_FORMAT, _validate_date, _validate_date_range, resolve_output_dir, is_word_file).
Feature Integration
audigen_cli/extractor.py, audigen_cli/llm_client.py, audigen_cli/excelWriter.py
Extractor accepts brd_path argument; llm_client removes debug logging; excelWriter adds runtime-aware template path resolution via _get_base_path() (PyInstaller frozen-mode support), expands function signatures to accept ticket, user, approver, and out_dir for output file naming and cell population.
Package Configuration
pyproject.toml
Python runtime tightened to >=3.12,<3.15; runtime dependencies expanded with rich and questionary; adds auditgen CLI entrypoint to audigen_cli.cli:cli; dev group includes pyinstaller.
CI/CD & Release
.github/workflows/build.yml
GitHub Actions workflow triggered on v* tags and manual dispatch; checks out, installs Python 3.12 + Poetry + dependencies, runs PyInstaller with hidden imports and --collect-all directives, uploads dist/auditgen.exe artifact, and creates a GitHub Release with the executable attached.
Documentation
README.md, CHANGELOG.md
README documents purpose, requirements (Windows/Gemini API key), installation, usage examples (interactive and flag-based), output file descriptions, and tech stack; CHANGELOG lists v0.1.0 (2025-04-26) features including dual-mode CLI, config setup, generation capabilities, Windows packaging, validation, and Ctrl+C handling.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as cli.py<br/>(generate command)
    participant Config as config.py
    participant Validation as utils.py
    participant Extractor as extractor.py
    participant LLM as llm_client.py
    participant ExcelWriter as excelWriter.py

    User->>CLI: auditgen generate [flags/interactive]
    CLI->>CLI: Print banner
    CLI->>Config: load_config() & check API key
    alt API key missing
        CLI->>User: Error & Exit
    end
    
    CLI->>Validation: Resolve BRD path, ticket, dates
    CLI->>Validation: Validate date format & range
    CLI->>Validation: Prompt for missing values
    CLI->>Validation: resolve_output_dir(ticket_id, output_arg)
    
    CLI->>Extractor: extractDoc(brd_path)
    Extractor->>Extractor: Parse .docx, sanitize content
    Extractor-->>CLI: sanitized_text
    
    CLI->>CLI: Set GEMINI_API_KEY env var
    CLI->>LLM: callLLM(sanitized_text)
    LLM->>LLM: Call Gemini API
    LLM-->>CLI: llm_generateTestCase (structured output)
    
    CLI->>ExcelWriter: startExcelChange(llm_result, dates, ticket, user, approver, out_dir)
    ExcelWriter->>ExcelWriter: Load templates from _get_base_path()
    ExcelWriter->>ExcelWriter: Update Impact Analysis, Code Checklist, Revision History
    ExcelWriter->>ExcelWriter: Write 3 Excel files to out_dir/ticket_id/
    ExcelWriter-->>CLI: Success
    
    CLI->>User: Print completion summary
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 A new CLI hops into view,
Config persists, prompts shine bright and true,
From BRD to Excel, the audit flows free,
Windows EXE packed, ready for spree!
Windows EXE packed, ready to spree! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Develop' is vague and does not convey meaningful information about the changeset. It fails to describe the primary purpose or scope of the changes. Use a descriptive title that summarizes the main change, such as 'Add CLI with config management and Excel report generation' or 'Implement AudiGen CLI with interactive prompts and Windows packaging'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch develop

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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@ThiruNithish28 ThiruNithish28 self-assigned this May 4, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 12

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/build.yml:
- Around line 60-64: The "Create Github Release" step (uses:
softprops/action-gh-release@v2) runs on manual workflow_dispatch and tag pushes
causing failures when no tag exists; add a conditional like if:
startsWith(github.ref, 'refs/tags/') to the step to ensure the release action
(files: dist/auditgen.exe, generate_release_notes: true) only executes for
tag-created workflows.
- Around line 3-4: The workflow currently sets the compatibility env var
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 to force Node 24 for older actions; either
keep that env var as-is for compatibility or upgrade the referenced actions to
versions that natively support Node.js 24 (replace checkout@v4 → checkout@v5+,
setup-python@v5 → setup-python@v6+, upload-artifact@v4 → upload-artifact@v6+,
action-gh-release@v2 → action-gh-release@v3+) and then remove the
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 line; update the workflow action references
accordingly and run the workflow to confirm no deprecation warnings.

In `@audigen_cli/banner.py`:
- Around line 1-5: The file imports Console twice; remove the duplicate import
statement so only a single "from rich.console import Console" remains; edit
audigen_cli/banner.py to delete the redundant Console import (the duplicate
line) and keep the other imports (Text, Panel, Align) unchanged to avoid unused
or duplicate import warnings.

In `@audigen_cli/cli.py`:
- Line 61: The string passed to questionary.confirm in the create assignment is
using an unnecessary f-string (causing Ruff F541); update the call in the
expression create = _ask(questionary.confirm(f"Folder does not exist. Create
it?", style=custom_style)) to use a plain string without the f prefix — e.g.
questionary.confirm("Folder does not exist. Create it?", style=custom_style) —
leaving the surrounding _ask helper and variable name create unchanged.
- Around line 264-273: The current crash handler inside the if __name__ ==
"__main__" block never runs for the installed entrypoint because the entrypoint
calls audigen_cli.cli:cli directly; fix by adding a new top-level main()
function in audigen_cli.cli that wraps the existing cli() call with the
try/except crash-logging logic (move the traceback import, log_path creation,
file write, print, and SystemExit into main), keep cli() unchanged, and update
pyproject.toml entrypoint to point to audigen_cli.cli:main so the installed
command runs the crash-handling wrapper.
- Around line 114-117: The checkbox prompt in config_setup calls
questionary.checkbox(...).ask() directly so Ctrl+C returns None and triggers the
wrong message; instead build the Question object with questionary.checkbox(...)
and pass it to the existing _ask(...) wrapper (i.e., replace
questionary.checkbox(...).ask() with _ask(questionary.checkbox(...))) so that
Ctrl+C is handled consistently and the "Aborted." message is shown; update the
assignment to selected_keys = _ask(questionary.checkbox(...)) and keep the
existing if not selected_keys: logic unchanged.
- Around line 202-204: The interactive fallback prompts hardcode choices for
complexity and priority, causing drift from the Click constants; update the
generate() logic (the lines setting complexity and priority using _ask and
questionary.select) to reuse the raw choice lists derived from
COMPLEXITY_CHOICES and PRIORITY_CHOICES (or their underlying values) instead of
hardcoding ["LOW","MEDIUM","HIGH"] and ["P1","P2","P3"], so the
questionary.select calls reference the same shared choice definitions as the
click.Choice constants; keep use of _ask, questionary.select and custom_style
intact while pulling the choices from those constants.

In `@audigen_cli/config.py`:
- Around line 25-28: The save_config function currently writes CONFIG_FILE with
default umask-permissions making the stored api_key world-readable; after the
json.dump finishes in save_config, call os.chmod(CONFIG_FILE, 0o600) to restrict
file permissions to owner read/write only (and add an import os if missing);
keep the existing _ensure_config_dir() and write flow but ensure chmod runs
after closing the file to apply the secure mode.
- Around line 17-22: The load_config function should guard against a corrupted
JSON file: wrap the json.load(CONFIG_FILE) call (inside load_config) in a
try/except that catches json.JSONDecodeError; when caught, log or print a
warning (include CONFIG_FILE name), move/rename the corrupted file to a backup
(so it’s not lost), and return a safe configuration (e.g., dict(DEFAULTS) or
{**DEFAULTS}); optionally write DEFAULTS back to CONFIG_FILE after ensuring the
directory via _ensure_config_dir(). Ensure you reference load_config,
CONFIG_FILE, DEFAULTS and _ensure_config_dir when updating the code.

In `@CHANGELOG.md`:
- Line 3: The release date in the changelog header "## [v0.1.0] - 2025-04-26" is
incorrect; update that line to the correct release/tag date (for example change
2025-04-26 to 2025-05-04 or the actual planned release date) while preserving
the existing header format "## [v0.1.0] - YYYY-MM-DD" so the version heading
remains consistent.
- Around line 1-11: The Markdown headings in the changelog (e.g., "# Changelog",
"## [v0.1.0] - 2025-04-26", and "### Added") need blank lines before and after
each heading and the file must end with a trailing newline to satisfy
MD022/MD047; update CHANGELOG.md to insert a blank line above "## [v0.1.0] -
2025-04-26" and above "### Added" (and ensure a blank line between each heading
and the list that follows), and add a final newline at EOF.

In `@README.md`:
- Around line 1-45: The README has Markdown spacing and minor grammar issues:
add a blank line before and after each heading (e.g., "# AudiGen CLI", "##
Requirements", "## Installation", "## First-Time Setup", "## Usage", "##
Output", "## Built With") and ensure fenced code blocks use blank lines above
and below the ```cmd blocks (both the single-line `auditgen config setup` and
the multi-line usage example). Replace the heading text "First Time Setup" with
"First-Time Setup" to hyphenate the adjective, ensure the file ends with a
trailing newline (MD047), and remove any stray or duplicate punctuation/spacing
in the "Built With" list (e.g., ensure "Rich + Questionary — terminal UI"
appears once).
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7480a2b9-be8c-4fd3-af45-a6abd8cc2c2a

📥 Commits

Reviewing files that changed from the base of the PR and between 118323b and df042a1.

⛔ Files ignored due to path filters (2)
  • poetry.lock is excluded by !**/*.lock
  • template/Vendor initiation date and time should be captured in the checklevel report.docx is excluded by !**/*.docx
📒 Files selected for processing (12)
  • .github/workflows/build.yml
  • CHANGELOG.md
  • README.md
  • audigen_cli/banner.py
  • audigen_cli/cli.py
  • audigen_cli/config.py
  • audigen_cli/excelWriter.py
  • audigen_cli/extractor.py
  • audigen_cli/llm_client.py
  • audigen_cli/ui.py
  • audigen_cli/utils.py
  • pyproject.toml
💤 Files with no reviewable changes (1)
  • audigen_cli/llm_client.py

Comment on lines +3 to +4
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the Node.js compatibility of the GitHub Actions used in this workflow

echo "=== Checking Node.js compatibility for GitHub Actions ==="
echo ""
echo "Actions used in workflow:"
echo "- actions/checkout@v4"
echo "- actions/setup-python@v5"
echo "- actions/upload-artifact@v4"
echo "- softprops/action-gh-release@v2"
echo ""
echo "Checking if these actions support Node.js 24 by default..."

# Check each action's latest release/docs for Node.js compatibility
for action in "actions/checkout" "actions/setup-python" "actions/upload-artifact" "softprops/action-gh-release"; do
  echo ""
  echo "--- $action ---"
  gh api repos/$action/releases/latest --jq '.name, .published_at' 2>/dev/null || echo "Could not fetch release info"
done

Repository: ThiruNithish28/audiGen-cli

Length of output: 563


🌐 Web query:

Do GitHub Actions checkout@v4, setup-python@v5, upload-artifact@v4, and action-gh-release@v2 natively support Node.js 24?

💡 Result:

No, GitHub Actions checkout@v4, setup-python@v5, upload-artifact@v4, and action-gh-release@v2 do not natively support Node.js 24. They run on Node.js 20 by default and trigger deprecation warnings. Newer versions are required for native Node.js 24 support (e.g., checkout@v5+, setup-python@v6+, upload-artifact@v6+, action-gh-release@v3+).

Citations:


Update GitHub Actions to versions that natively support Node.js 24, or keep FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 as a compatibility measure.

The current actions (checkout@v4, setup-python@v5, upload-artifact@v4, action-gh-release@v2) do not natively support Node.js 24 and default to Node.js 20, triggering deprecation warnings. The FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 variable is necessary for your current setup.

For long-term maintenance, consider upgrading to action versions that natively support Node.js 24: checkout@v5+, setup-python@v6+, upload-artifact@v6+, action-gh-release@v3+. This would allow removing the environment variable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build.yml around lines 3 - 4, The workflow currently sets
the compatibility env var FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 to force Node 24
for older actions; either keep that env var as-is for compatibility or upgrade
the referenced actions to versions that natively support Node.js 24 (replace
checkout@v4 → checkout@v5+, setup-python@v5 → setup-python@v6+,
upload-artifact@v4 → upload-artifact@v6+, action-gh-release@v2 →
action-gh-release@v3+) and then remove the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24
line; update the workflow action references accordingly and run the workflow to
confirm no deprecation warnings.

Comment on lines +60 to +64
- name: Create Github Release
uses: softprops/action-gh-release@v2
with:
files: dist/auditgen.exe
generate_release_notes: true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add condition to prevent release step failure on manual triggers.

The release creation step will run on both tag pushes and manual workflow_dispatch triggers. When triggered manually without a tag context, this step will likely fail or produce unexpected results.

🔧 Proposed fix to conditionally run release only on tags
       
       - name: Create Github Release
         uses: softprops/action-gh-release@v2
+        if: startsWith(github.ref, 'refs/tags/')
         with:
           files: dist/auditgen.exe
           generate_release_notes: true
📝 Committable suggestion

‼️ 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.

Suggested change
- name: Create Github Release
uses: softprops/action-gh-release@v2
with:
files: dist/auditgen.exe
generate_release_notes: true
- name: Create Github Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/auditgen.exe
generate_release_notes: true
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/build.yml around lines 60 - 64, The "Create Github
Release" step (uses: softprops/action-gh-release@v2) runs on manual
workflow_dispatch and tag pushes causing failures when no tag exists; add a
conditional like if: startsWith(github.ref, 'refs/tags/') to the step to ensure
the release action (files: dist/auditgen.exe, generate_release_notes: true) only
executes for tag-created workflows.

Comment thread audigen_cli/banner.py
Comment on lines +1 to +5
from rich.console import Console
from rich.text import Text
from rich.console import Console
from rich.panel import Panel
from rich.align import Align
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove the duplicate Console import on Line 3.

from rich.console import Console appears on both line 1 and line 3.

🔧 Proposed fix
 from rich.console import Console
 from rich.text import Text
-from rich.console import Console
 from rich.panel import Panel
 from rich.align import Align
📝 Committable suggestion

‼️ 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.

Suggested change
from rich.console import Console
from rich.text import Text
from rich.console import Console
from rich.panel import Panel
from rich.align import Align
from rich.console import Console
from rich.text import Text
from rich.panel import Panel
from rich.align import Align
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@audigen_cli/banner.py` around lines 1 - 5, The file imports Console twice;
remove the duplicate import statement so only a single "from rich.console import
Console" remains; edit audigen_cli/banner.py to delete the redundant Console
import (the duplicate line) and keep the other imports (Text, Panel, Align)
unchanged to avoid unused or duplicate import warnings.

Comment thread audigen_cli/cli.py
if key == "output_dir":
path = Path(value.strip())
if not path.exists():
create = _ask(questionary.confirm(f"Folder does not exist. Create it?", style=custom_style))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove the f prefix — this f-string has no placeholders (Ruff F541).

🔧 Proposed fix
-            create = _ask(questionary.confirm(f"Folder does not exist. Create it?", style=custom_style))
+            create = _ask(questionary.confirm("Folder does not exist. Create it?", style=custom_style))
📝 Committable suggestion

‼️ 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.

Suggested change
create = _ask(questionary.confirm(f"Folder does not exist. Create it?", style=custom_style))
create = _ask(questionary.confirm("Folder does not exist. Create it?", style=custom_style))
🧰 Tools
🪛 Ruff (0.15.12)

[error] 61-61: f-string without any placeholders

Remove extraneous f prefix

(F541)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@audigen_cli/cli.py` at line 61, The string passed to questionary.confirm in
the create assignment is using an unnecessary f-string (causing Ruff F541);
update the call in the expression create = _ask(questionary.confirm(f"Folder
does not exist. Create it?", style=custom_style)) to use a plain string without
the f prefix — e.g. questionary.confirm("Folder does not exist. Create it?",
style=custom_style) — leaving the surrounding _ask helper and variable name
create unchanged.

Comment thread audigen_cli/cli.py
Comment on lines +114 to +117
selected_keys = questionary.checkbox(
"Select fields to configure:(space to toggle, enter to confirm)",
choices=choices
).ask()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

config_setup bypasses _ask() — Ctrl+C during the checkbox prompt shows the wrong message.

questionary.checkbox(...).ask() is called directly instead of through _ask(). When the user presses Ctrl+C, .ask() returns None, which the if not selected_keys: guard then turns into "⚠ No fields selected. Aborting setup." instead of the consistent "Aborted." message produced by _ask().

🔧 Proposed fix
-    selected_keys = questionary.checkbox(
-        "Select fields to configure:(space to toggle, enter to confirm)", 
-        choices=choices
-    ).ask()
-
-    if not selected_keys:
-        console.print("[yellow]⚠ No fields selected. Aborting setup.[/yellow]")
-        return
+    selected_keys = _ask(questionary.checkbox(
+        "Select fields to configure:(space to toggle, enter to confirm)",
+        choices=choices,
+    ))
+    if not selected_keys:
+        console.print("[yellow]⚠ No fields selected. Aborting setup.[/yellow]")
+        return
📝 Committable suggestion

‼️ 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.

Suggested change
selected_keys = questionary.checkbox(
"Select fields to configure:(space to toggle, enter to confirm)",
choices=choices
).ask()
selected_keys = _ask(questionary.checkbox(
"Select fields to configure:(space to toggle, enter to confirm)",
choices=choices,
))
if not selected_keys:
console.print("[yellow]⚠ No fields selected. Aborting setup.[/yellow]")
return
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@audigen_cli/cli.py` around lines 114 - 117, The checkbox prompt in
config_setup calls questionary.checkbox(...).ask() directly so Ctrl+C returns
None and triggers the wrong message; instead build the Question object with
questionary.checkbox(...) and pass it to the existing _ask(...) wrapper (i.e.,
replace questionary.checkbox(...).ask() with _ask(questionary.checkbox(...))) so
that Ctrl+C is handled consistently and the "Aborted." message is shown; update
the assignment to selected_keys = _ask(questionary.checkbox(...)) and keep the
existing if not selected_keys: logic unchanged.

Comment thread audigen_cli/config.py
Comment on lines +17 to +22
def load_config() -> dict:
_ensure_config_dir()
if not CONFIG_FILE.exists():
return dict(DEFAULTS)
with open(CONFIG_FILE, "r") as f:
return {**DEFAULTS,**json.load(f)}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Handle json.JSONDecodeError — a corrupted config crashes the entire tool.

If ~/.auditgen/config.json contains invalid JSON (e.g., partial write, manual edit mistake), json.load(f) raises json.JSONDecodeError which propagates unhandled and kills any auditgen invocation.

🛡️ Proposed fix
 def load_config() -> dict:
     _ensure_config_dir()
     if not CONFIG_FILE.exists():
         return dict(DEFAULTS)
-    with open(CONFIG_FILE, "r") as f:
-        return {**DEFAULTS, **json.load(f)}
+    try:
+        with open(CONFIG_FILE) as f:
+            return {**DEFAULTS, **json.load(f)}
+    except json.JSONDecodeError:
+        return dict(DEFAULTS)
🧰 Tools
🪛 Ruff (0.15.12)

[warning] 21-21: Unnecessary mode argument

Remove mode argument

(UP015)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@audigen_cli/config.py` around lines 17 - 22, The load_config function should
guard against a corrupted JSON file: wrap the json.load(CONFIG_FILE) call
(inside load_config) in a try/except that catches json.JSONDecodeError; when
caught, log or print a warning (include CONFIG_FILE name), move/rename the
corrupted file to a backup (so it’s not lost), and return a safe configuration
(e.g., dict(DEFAULTS) or {**DEFAULTS}); optionally write DEFAULTS back to
CONFIG_FILE after ensuring the directory via _ensure_config_dir(). Ensure you
reference load_config, CONFIG_FILE, DEFAULTS and _ensure_config_dir when
updating the code.

Comment thread audigen_cli/config.py
Comment on lines +25 to +28
def save_config(data: dict):
_ensure_config_dir()
with open(CONFIG_FILE, "w") as f:
json.dump(data, f, indent=2)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restrict file permissions after saving — the API key is world-readable by default.

save_config writes api_key in plaintext to ~/.auditgen/config.json with whatever permissions the process umask produces (typically 0o644 on Linux/macOS), making it readable by any local user. Apply chmod 0o600 immediately after writing.

🔒 Proposed fix
 def save_config(data: dict):
     _ensure_config_dir()
     with open(CONFIG_FILE, "w") as f:
         json.dump(data, f, indent=2)
+    CONFIG_FILE.chmod(0o600)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@audigen_cli/config.py` around lines 25 - 28, The save_config function
currently writes CONFIG_FILE with default umask-permissions making the stored
api_key world-readable; after the json.dump finishes in save_config, call
os.chmod(CONFIG_FILE, 0o600) to restrict file permissions to owner read/write
only (and add an import os if missing); keep the existing _ensure_config_dir()
and write flow but ensure chmod runs after closing the file to apply the secure
mode.

Comment thread CHANGELOG.md
Comment on lines +1 to +11
# Changelog

## [v0.1.0] - 2025-04-26
### Added
- Interactive dual-mode CLI (flags or questionary prompts)
- Config registry with `auditgen config setup`
- Generates Impact Analysis, Test Cases, Code Checklist from BRD
- Windows EXE via GitHub Actions
- Input validation with friendly error messages
- Path traversal protection on ticket ID
- Ctrl+C handling across all prompts No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Fix Markdown formatting for consistency.

Add blank lines around headings and a trailing newline to comply with Markdown best practices (MD022, MD047).

📝 Proposed formatting fixes
 # Changelog
 
 ## [v0.1.0] - 2025-04-26
+
 ### Added
+
 - Interactive dual-mode CLI (flags or questionary prompts)
 - Config registry with `auditgen config setup`
 - Generates Impact Analysis, Test Cases, Code Checklist from BRD
 - Windows EXE via GitHub Actions
 - Input validation with friendly error messages
 - Path traversal protection on ticket ID
-- Ctrl+C handling across all prompts
+- Ctrl+C handling across all prompts
+

As per coding guidelines, static analysis identified these Markdown best practices (MD022, MD047).

📝 Committable suggestion

‼️ 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.

Suggested change
# Changelog
## [v0.1.0] - 2025-04-26
### Added
- Interactive dual-mode CLI (flags or questionary prompts)
- Config registry with `auditgen config setup`
- Generates Impact Analysis, Test Cases, Code Checklist from BRD
- Windows EXE via GitHub Actions
- Input validation with friendly error messages
- Path traversal protection on ticket ID
- Ctrl+C handling across all prompts
# Changelog
## [v0.1.0] - 2025-04-26
### Added
- Interactive dual-mode CLI (flags or questionary prompts)
- Config registry with `auditgen config setup`
- Generates Impact Analysis, Test Cases, Code Checklist from BRD
- Windows EXE via GitHub Actions
- Input validation with friendly error messages
- Path traversal protection on ticket ID
- Ctrl+C handling across all prompts
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 4-4: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


[warning] 4-4: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


[warning] 11-11: Files should end with a single newline character

(MD047, single-trailing-newline)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CHANGELOG.md` around lines 1 - 11, The Markdown headings in the changelog
(e.g., "# Changelog", "## [v0.1.0] - 2025-04-26", and "### Added") need blank
lines before and after each heading and the file must end with a trailing
newline to satisfy MD022/MD047; update CHANGELOG.md to insert a blank line above
"## [v0.1.0] - 2025-04-26" and above "### Added" (and ensure a blank line
between each heading and the list that follows), and add a final newline at EOF.

Comment thread CHANGELOG.md
@@ -0,0 +1,11 @@
# Changelog

## [v0.1.0] - 2025-04-26
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Verify the release date.

The changelog shows 2025-04-26 but this PR was created on 2025-05-04. Ensure the date reflects when the version will actually be released, or update it to match the PR/tag date if this is a documentation-first approach.

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 3-3: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CHANGELOG.md` at line 3, The release date in the changelog header "##
[v0.1.0] - 2025-04-26" is incorrect; update that line to the correct release/tag
date (for example change 2025-04-26 to 2025-05-04 or the actual planned release
date) while preserving the existing header format "## [v0.1.0] - YYYY-MM-DD" so
the version heading remains consistent.

Comment thread README.md
Comment on lines +1 to +45
# AudiGen CLI

Audit document generator CLI tool — generates Impact Analysis, Test Cases,
and Code Review Checklist from a BRD document using AI.

## Requirements
- Windows 10/11
- Gemini API key ([get one free here](https://aistudio.google.com/))

## Installation
1. Download `auditgen.exe` from [Releases](../../releases)
2. Place it in a folder e.g. `C:\Tools\auditgen\`
3. Add that folder to your Windows PATH
4. Open a new terminal and run `auditgen --help`

## First Time Setup
```cmd
auditgen config setup
```
Select all fields and enter your details when prompted.

## Usage
```cmd
# Interactive mode — prompts for everything
auditgen generate

# Direct mode — pass everything as flags
auditgen generate "path\to\brd.docx" TKT-001 -s 20-04-2025 -e 30-04-2025

# View your config
auditgen config show
```

## Output
Running `generate` produces three Excel files in your output folder:
- `TKT-001-Impact Analysis Template.xlsx`
- `TKT-001-Test Cases.xlsx`
- `TKT-001-Code Checklist.xlsx`

## Built With
- Python 3.12
- Click — CLI framework
- Google Gemini — test case generation
- openpyxl — Excel generation
- Rich + Questionary — terminal UI No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Fix Markdown formatting for better readability.

The README has several formatting issues flagged by static analysis:

  • Missing blank lines around headings (MD022)
  • Missing blank lines around fenced code blocks (MD031)
  • Missing trailing newline (MD047)
  • "First Time" should be hyphenated as "First-Time" when used as an adjective
📝 Proposed formatting fixes
 # AudiGen CLI
 
 Audit document generator CLI tool — generates Impact Analysis, Test Cases, 
 and Code Review Checklist from a BRD document using AI.
 
 ## Requirements
+
 - Windows 10/11
 - Gemini API key ([get one free here](https://aistudio.google.com/))
 
 ## Installation
+
 1. Download `auditgen.exe` from [Releases](../../releases)
 2. Place it in a folder e.g. `C:\Tools\auditgen\`
 3. Add that folder to your Windows PATH
 4. Open a new terminal and run `auditgen --help`
 
-## First Time Setup
+## First-Time Setup
+
 ```cmd
 auditgen config setup

Select all fields and enter your details when prompted.

Usage

# Interactive mode — prompts for everything
auditgen generate

# Direct mode — pass everything as flags
auditgen generate "path\to\brd.docx" TKT-001 -s 20-04-2025 -e 30-04-2025

# View your config
auditgen config show

Output

Running generate produces three Excel files in your output folder:

  • TKT-001-Impact Analysis Template.xlsx
  • TKT-001-Test Cases.xlsx
  • TKT-001-Code Checklist.xlsx

Built With

  • Python 3.12
  • Click — CLI framework
  • Google Gemini — test case generation
  • openpyxl — Excel generation
    -- Rich + Questionary — terminal UI
    +- Rich + Questionary — terminal UI
</details>

As per coding guidelines, static analysis identified these Markdown best practices (MD022, MD031, MD047) and grammar improvements.

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

<details>
<summary>🪛 LanguageTool</summary>

[grammar] ~16-~16: Use a hyphen to join words.
Context: ...inal and run `auditgen --help`  ## First Time Setup ```cmd auditgen config setup ...

(QB_NEW_EN_HYPHEN)

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

[warning] 6-6: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

---

[warning] 10-10: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

---

[warning] 16-16: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

---

[warning] 17-17: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

---

[warning] 19-19: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

---

[warning] 22-22: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

---

[warning] 23-23: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

---

[warning] 34-34: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

---

[warning] 40-40: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

---

[warning] 45-45: Files should end with a single newline character

(MD047, single-trailing-newline)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @README.md around lines 1 - 45, The README has Markdown spacing and minor
grammar issues: add a blank line before and after each heading (e.g., "# AudiGen
CLI", "## Requirements", "## Installation", "## First-Time Setup", "## Usage",
"## Output", "## Built With") and ensure fenced code blocks use blank lines
above and below the ```cmd blocks (both the single-line auditgen config setup
and the multi-line usage example). Replace the heading text "First Time Setup"
with "First-Time Setup" to hyphenate the adjective, ensure the file ends with a
trailing newline (MD047), and remove any stray or duplicate punctuation/spacing
in the "Built With" list (e.g., ensure "Rich + Questionary — terminal UI"
appears once).


</details>

<!-- fingerprinting:phantom:triton:puma:101f1b88-ee41-462b-92b9-479ef71fb4f7 -->

<!-- d98c2f50 -->

<!-- This is an auto-generated comment by CodeRabbit -->

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Cannot run autofix: This PR has merge conflicts.

Please resolve the conflicts with the base branch and try again.

Alternatively, use @coderabbitai resolve merge conflict to automatically resolve the conflicts.

@ThiruNithish28
Copy link
Copy Markdown
Owner Author

@coderabbitai resolve merge conflict

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

An unexpected error occurred while resolving merge conflicts:

Resource not accessible by integration - https://docs.github.com/rest/git/trees#create-a-tree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant