Skip to content

Update shopt.sh#154

Merged
Ven0m0 merged 15 commits intomainfrom
local/bin
Jan 4, 2026
Merged

Update shopt.sh#154
Ven0m0 merged 15 commits intomainfrom
local/bin

Conversation

@Ven0m0
Copy link
Copy Markdown
Owner

@Ven0m0 Ven0m0 commented Jan 4, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 4, 2026 13:13
@continue
Copy link
Copy Markdown

continue bot commented Jan 4, 2026

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 4, 2026

🤖 Hi @Ven0m0, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Ven0m0, I'm Gemini Code Assist1! 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!

This pull request refactors the shopt.sh script to significantly reduce its reliance on external tools for preprocessing, string manipulation, and code formatting. By implementing core functionalities directly in bash or leveraging standard utilities like sed and awk, the script becomes more self-contained and robust. Additionally, logging has been enhanced with colored output for better readability, and the overall code structure has been streamlined.

Highlights

  • Dependency Reduction: The script now relies less on external tools by implementing functionalities like preprocessing and string normalization directly in bash or using standard utilities like sed and awk. Specifically, external preprocess, beautysh, and sd tools are no longer required.
  • Native Bash Preprocessor: A new preprocess_shell function has been introduced, providing a pure bash implementation for handling conditional compilation directives (#ifdef, #ifndef, #else, #endif), replacing the need for the external preprocess utility.
  • Enhanced Logging: Logging functions have been refactored to include colored output (clog, cwarn, cerr), improving the readability and clarity of messages printed to the console.
  • Simplified Formatting: The script now exclusively uses shfmt for code formatting, removing the dependency on beautysh and streamlining the formatting process.
  • Variant Handling Updates: The default shell variants for compilation have been narrowed down to bash only, and the command-line parsing for the -V (variants) option has been explicitly added and clarified in the usage message.
Ignored Files
  • Ignored by pattern: .github/workflows/** (9)
    • .github/workflows/claude-code-review.yml
    • .github/workflows/claude-pr-auto-review.yml
    • .github/workflows/claude.yml
    • .github/workflows/codacy.yml
    • .github/workflows/dependency-review.yml
    • .github/workflows/eslint.yml
    • .github/workflows/gemini-scheduled-triage.yml
    • .github/workflows/pyre.yml
    • .github/workflows/summary.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

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.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant refactoring of the shopt.sh script. The main changes include removing external dependencies like preprocess, sd, and beautysh, and replacing them with pure bash implementations or standard tools like sed and shfmt. A new pure-bash preprocessor for handling #ifdef-style directives is added. The logging functions have also been refactored for better clarity.

Overall, these changes are a great improvement, making the script more self-contained and portable. I've found a few issues, including a critical bug in environment variable setting and some typos in regular expressions that break functionality. I've also noted a logic bug in the new preprocessor and a point about bash version compatibility.

Ven0m0 and others added 6 commits January 4, 2026 14:16
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Ven0m0 Ven0m0 merged commit 60a9e89 into main Jan 4, 2026
3 of 8 checks passed
@Ven0m0 Ven0m0 deleted the local/bin branch January 4, 2026 13:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the shopt.sh shell script optimizer and updates GitHub Actions workflows. The main focus is replacing external preprocessor dependencies with a pure Bash implementation and consolidating workflow files for Claude AI integration.

Key Changes

  • Replaced external preprocess dependency with a custom pure Bash preprocessor for shell variant handling
  • Removed dependencies on optional tools (sd, beautysh, preprocess) and consolidated normalization into native sed
  • Consolidated GitHub Actions workflows: removed 5 security/analysis workflows and added 2 new Claude AI workflows

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
Home/.local/bin/shopt.sh Major refactor: added pure Bash preprocessor, removed external tool dependencies, improved logging functions, fixed find command grouping
.github/workflows/claude.yml New workflow for Claude AI mention-based triggers on issues and PRs
.github/workflows/claude-code-review.yml New workflow for automatic PR reviews using Claude AI
.github/workflows/summary.yml Removed AI inference workflow for issue summarization
.github/workflows/pyre.yml Removed Python type checking workflow
.github/workflows/gemini-scheduled-triage.yml Removed Gemini-based issue triage workflow
.github/workflows/eslint.yml Removed ESLint security scanning workflow
.github/workflows/dependency-review.yml Removed dependency review workflow
.github/workflows/codacy.yml Removed Codacy security scanning workflow
.github/workflows/claude-pr-auto-review.yml Removed older Claude PR auto-review workflow

Comment on lines +95 to +100
local var="${BASH_REMATCH[1]}"
stack+=("$active")
((depth++))
((active == 1 && var == "$def")) && active=1 || active=0
elif [[ $line =~ ^[[:space:]]*#ifndef[[:space:]]+(.+)$ ]]; then
local var="${BASH_REMATCH[1]}"
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

Variable line is declared in the function parameters but then redeclared inside the loop with local var="${BASH_REMATCH[1]}". The variable name conflicts with the loop variable line.

This will cause the variable name var to shadow or conflict with the intended usage, potentially breaking the preprocessor logic.

Copilot uses AI. Check for mistakes.
[[ ${#files[@]} -gt 1 && -n $output && $output != - ]] && ((! compile && !concat)) && die "Multiple files with single output unsupported (use -c/--compile)"

read -r -d '' AWK_STRIP <<'AWK' || :
# AWK script: strip comments/blank lines, keep shebang
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

Missing space in comment formatting. The comment should have consistent spacing: # AWK script: strip instead of # AWK script: strip (double space after colon).

Suggested change
# AWK script: strip comments/blank lines, keep shebang
# AWK script: strip comments/blank lines, keep shebang

Copilot uses AI. Check for mistakes.
Comment on lines +90 to +91
local -a stack=() line
local active=1 depth=0
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

Variable line is incorrectly declared in the local declaration on line 90. The declaration local -a stack=() line declares line as part of an array declaration statement, but line should be a scalar variable for use in the while loop.

This should be split into two separate declarations: one for the array and one for the scalar.

Suggested change
local -a stack=() line
local active=1 depth=0
local -a stack=()
local line active=1 depth=0

Copilot uses AI. Check for mistakes.
files=("$target")
fi
((${#files[@]} == 0 && !compile && !concat)) && { clog "No scripts found"; exit 0; }
[[ ${#files[@]} -gt 1 && -n $output && $output != - ]] && ((! compile && !concat)) && die "Multiple files require -c/--compile"
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

Missing space before the negation operator. The condition has a double space: ((! compile should be ((! compile with a single space.

Suggested change
[[ ${#files[@]} -gt 1 && -n $output && $output != - ]] && ((! compile && !concat)) && die "Multiple files require -c/--compile"
[[ ${#files[@]} -gt 1 && -n $output && $output != - ]] && ((! compile && !concat)) && die "Multiple files require -c/--compile"

Copilot uses AI. Check for mistakes.

if ((compile || concat)); then
[[ ! -d $target ]] && die "Compile/concat mode needs directory"
[[ ! -d $target ]] && die "Compile/concat mode needs directory"
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

Unquoted variable in test expression. The variable $target should be quoted to prevent word splitting and glob expansion.

This violates bash best practices and can cause unexpected behavior if the target path contains spaces or special characters.

Suggested change
[[ ! -d $target ]] && die "Compile/concat mode needs directory"
[[ ! -d "$target" ]] && die "Compile/concat mode needs directory"

Copilot uses AI. Check for mistakes.
stack+=("$active")
((depth++))
((active == 1 && var == "$def")) && active=1 || active=0
elif [[ $line =~ ^[[:space:]]*#ifndef[[:space:]]+(.+)$ ]]; then
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

The regex pattern has a typo with an incorrect character class syntax. The pattern [[: space:]] is malformed - there should be a colon immediately after the opening bracket.

This will cause the regex match to fail, preventing the preprocessor from recognizing #ifndef directives.

Copilot uses AI. Check for mistakes.
continue
}
[[ $line =~ ^#! ]] && continue
if [[ $line =~ ^[[:space:]]*# ]]; then
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

The regex pattern has a typo with an incorrect character class syntax. The pattern [[: space:]] is malformed - there should be a colon immediately after the opening bracket.

This will cause comment detection to fail during the minification process.

Copilot uses AI. Check for mistakes.
((NR <= 10)) && [[ $line =~ Copyright|License ]] && { printf '%s\n' "$line" >>"$out"; continue; }
continue
fi
line=$(sed -E 's/^[[:space:]]*function[[:space:]]+([a-zA-Z0-9_]+)[[:space:]]*\{/\1(){/g' <<<"$line")
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

The regex pattern has a typo with an incorrect character class syntax. The pattern [[: space:]] is malformed - there should be a colon immediately after the opening bracket.

This will cause the function normalization pattern to fail during minification.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants