Skip to content

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Jan 20, 2026

Summary

  • Adds content/humanise.md subagent adapted from blader/humanizer to remove AI writing patterns
  • Adds /humanise slash command for on-demand text humanisation
  • Adds humanise-update-helper.sh to check for upstream skill updates

Features

The humanise subagent detects and fixes 24 AI writing patterns including:

  • Inflated significance ("pivotal moment", "testament to")
  • Promotional language ("nestled", "vibrant", "breathtaking")
  • AI vocabulary (delve, tapestry, landscape, pivotal, crucial)
  • Rule of three overuse, negative parallelisms
  • Em dash overuse, excessive hedging
  • Chatbot artifacts ("I hope this helps!")

Based on Wikipedia's "Signs of AI writing" guide maintained by WikiProject AI Cleanup.

Usage

/humanise [paste text here]

Or invoke via Content agent workflow.

Upstream Tracking

The subagent tracks upstream version (currently v2.1.1) and includes a helper script to check for updates:

humanise-update-helper.sh check   # Check for upstream updates
humanise-update-helper.sh diff    # Show diff between local and upstream

Files Changed

  • .agent/content/humanise.md - New subagent (adapted with British English)
  • .agent/scripts/commands/humanise.md - Slash command
  • .agent/scripts/humanise-update-helper.sh - Update checker
  • .agent/content.md - Updated to reference humanise
  • .agent/AGENTS.md - Documentation updates

Summary by CodeRabbit

  • New Features

    • Added /humanise command to transform AI-generated text into more natural, human-sounding prose with pattern detection and rewriting capabilities.
  • Documentation

    • Added comprehensive documentation for the humanise capability, including common AI-writing patterns to identify and fix, usage examples, and integration guidance within the content workflow.

✏️ Tip: You can customize this high-level summary in your review settings.

Adds a new humanise subagent adapted from blader/humanizer skill to remove
signs of AI-generated writing and make text sound more natural and human.

Features:
- content/humanise.md subagent with 24 AI writing patterns to detect/fix
- /humanise slash command for on-demand text humanisation
- humanise-update-helper.sh to check for upstream skill updates
- Integration with Content main agent workflow

Based on Wikipedia's 'Signs of AI writing' guide maintained by WikiProject
AI Cleanup. Tracks upstream version for easy updates when source changes.

Upstream: https://github.com/blader/humanizer (v2.1.1)
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This pull request introduces a new "humanise" subagent capability that removes AI writing patterns and transforms generated text into natural human-written prose. It includes comprehensive documentation, a command interface, and a helper script for managing upstream synchronization.

Changes

Cohort / File(s) Summary
Core Agent Documentation
.agent/AGENTS.md
Added /humanise to public slash commands list; updated content subagent entry to reference humanise capability and AI writing pattern removal; added humanise to Key Subagents tracking.
Humanise Subagent Definition
.agent/content.md, .agent/content/humanise.md
Registered humanise as new content subagent with metadata. Introduced comprehensive guide covering 15+ AI pattern categories (content emphasis, -ing forms, promotional language, vague attribution, structural templates, vocabulary, copula avoidance, parallelism, rule-of-three, variation, ranges, em-dash, formatting, headers, casing, emojis, quotes) with before/after examples and workflow steps. Updated publishing workflow to include humanise step.
Command Reference & Helper Script
.agent/scripts/commands/humanise.md, .agent/scripts/humanise-update-helper.sh
Added humanise command documentation with usage examples and pattern reference. Implemented Bash utility script for managing local/upstream synchronization: version parsing from frontmatter, 24-hour cache TTL, version comparison, diff generation (with delta/colordiff support), and colored status reporting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

AI prose met its match today, 🤖✨
Patterns found, then stripped away,
Human voice now leads the way,
No more indeed, no more em—dash display,
Text that reads like humans play! 🎭

✨ Finishing touches
  • 📝 Generate docstrings

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

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

@gemini-code-assist
Copy link

Summary of Changes

Hello @marcusquinn, 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 significantly enhances the content generation and refinement capabilities by integrating a new 'humanise' subagent. This subagent is specifically engineered to detect and eliminate common AI writing patterns, thereby transforming artificial-sounding text into more natural, human-like prose. It provides users with a convenient slash command for immediate text humanisation and incorporates a robust mechanism to track and apply updates from its upstream source, ensuring the tool remains effective and up-to-date in improving content quality.

Highlights

  • New 'humanise' Subagent: Introduces a new subagent, content/humanise.md, designed to identify and remove AI writing patterns from text, making it sound more natural and human. This subagent is adapted from the blader/humanizer project and includes British English adaptations.
  • New '/humanise' Slash Command: Adds a new slash command, /humanise, allowing users to humanise text on demand directly within the system. This command is defined in scripts/commands/humanise.md.
  • Upstream Update Helper Script: Includes a new bash script, humanise-update-helper.sh, which provides functionality to check for updates to the upstream blader/humanizer project, compare versions, and display differences, ensuring the subagent can be kept current.
  • Comprehensive AI Pattern Detection: The humanise subagent is equipped to detect and fix 24 distinct AI writing patterns, including inflated significance, promotional language, AI-specific vocabulary (e.g., 'delve', 'tapestry'), overuse of em dashes, negative parallelisms, and chatbot artifacts, all based on Wikipedia's 'Signs of AI writing' guide.
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.

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 314 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Tue Jan 20 02:29:12 UTC 2026: Code review monitoring started
Tue Jan 20 02:29:13 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 314
Tue Jan 20 02:29:13 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Tue Jan 20 02:29:15 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 314
  • VULNERABILITIES: 0

Generated on: Tue Jan 20 02:29:54 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

Copy link

@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 new humanise subagent and a corresponding /humanise slash command to remove AI writing patterns from text. The implementation is well-structured, including a detailed subagent prompt, a command definition, and a helper script for tracking upstream updates. The documentation has been updated accordingly. The code is of high quality, with only one minor suggestion for improvement in the update helper script to enhance error reporting.

fi

echo "Fetching upstream from ${UPSTREAM_REPO}..."
if curl -fsSL "$UPSTREAM_RAW" -o "$CACHE_FILE" 2>/dev/null; then

Choose a reason for hiding this comment

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

medium

Redirecting curl's stderr to /dev/null suppresses potentially useful error messages. If curl fails due to network issues (e.g., DNS resolution failure, connection refused), the user will only see a generic 'Failed to fetch upstream' message without any specific details, making troubleshooting difficult. Removing 2>/dev/null will allow curl to display these errors, improving the script's debuggability. The -s option already prevents the progress meter from being displayed.

Suggested change
if curl -fsSL "$UPSTREAM_RAW" -o "$CACHE_FILE" 2>/dev/null; then
if curl -fsSL "$UPSTREAM_RAW" -o "$CACHE_FILE"; then

Address review feedback: remove 2>/dev/null from curl to show
network errors when fetching upstream fails.
@augmentcode
Copy link

augmentcode bot commented Jan 20, 2026

🤖 Augment PR Summary

Summary: Adds a new “humanise” content subagent and command to help remove common AI-writing patterns from generated text.

Changes:

  • Introduced .agent/content/humanise.md (adapted from blader/humanizer) with rules/examples for detecting and rewriting 24 AI-ish patterns.
  • Added a /humanise slash command definition under .agent/scripts/commands/ for on-demand text humanisation.
  • Added .agent/scripts/humanise-update-helper.sh to fetch upstream SKILL.md, cache it, and show version/diff information.
  • Updated .agent/content.md to include the new subagent and document where it fits in the content workflow.
  • Updated .agent/AGENTS.md to list the new slash command and helper script in the documentation tables.

Technical Notes: The update helper pulls from raw.githubusercontent.com/blader/humanizer and caches the upstream copy/version for 24 hours to reduce repeated fetches.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

**Problem:** ChatGPT uses curly quotes ("...") instead of straight quotes ("...").

**Before:**
> He said "the project is on track" but others disagreed.
Copy link

Choose a reason for hiding this comment

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

In the “Curly Quotation Marks” section, the “Before” example uses straight quotes just like “After”, so it doesn’t actually demonstrate what to change for this pattern.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

echo "Focus on content changes in the upstream patterns."
echo ""

# Show diff (ignore frontmatter differences)
Copy link

Choose a reason for hiding this comment

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

The comment says the diff “ignore[s] frontmatter differences”, but the current diff -u compares the entire files (including frontmatter), which may be confusing when reviewing the output.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

@sonarqubecloud
Copy link

@github-actions
Copy link

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 314 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Tue Jan 20 02:31:38 UTC 2026: Code review monitoring started
Tue Jan 20 02:31:39 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 314
Tue Jan 20 02:31:39 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Tue Jan 20 02:31:41 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 314
  • VULNERABILITIES: 0

Generated on: Tue Jan 20 02:32:23 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@marcusquinn marcusquinn merged commit 7201703 into main Jan 20, 2026
7 of 8 checks passed
marcusquinn added a commit that referenced this pull request Jan 20, 2026
Combined commits:
- 🤖 AUTO-FIX: Apply code quality improvements
- feat(content): add humanise subagent for AI writing pattern removal (#128)
Copy link
Contributor

@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: 4

🤖 Fix all issues with AI agents
In @.agent/content.md:
- Around line 68-77: The Quick Reference workflow list at the top of
.agent/content.md is inconsistent with the new "Humanising Content" section: it
still lists "Optimize" as step 4 and omits the Humanise step. Update the Quick
Reference workflow list to include the Humanise step (referencing the /humanise
command or content/humanise.md) and renumber the subsequent steps so "Optimize"
follows the Humanise step; ensure the list labels and ordering match the
"Humanising Content" header and its description.

In @.agent/content/humanise.md:
- Around line 247-256: The blockquote heading in the "16. Title Case in
Headings" section is missing surrounding blank lines (triggering MD022); edit
.agent/content/humanise.md around the heading that contains "> ## Strategic
negotiations and global partnerships" (or any blockquote heading) and add a
blank line immediately before the blockquote line and a blank line immediately
after the blockquote block so the blockquote heading is separated from adjacent
paragraphs; ensure other blockquote headings in that section follow the same
pattern.

In @.agent/scripts/humanise-update-helper.sh:
- Around line 182-195: cmd_diff currently can proceed when the chosen subagent
file is missing, masking errors; add an explicit existence guard after resolving
subagent_file (the variable set from LOCAL_SUBAGENT or SOURCE_SUBAGENT in
cmd_diff) that checks [[ -f "$subagent_file" ]] and, if missing, prints a clear
error referencing the missing file and returns non-zero (return 1) so the script
fails fast; ensure this check is placed before any operations that rely on the
file and keeps the existing CACHE_FILE check intact.
- Around line 86-103: The compare_versions function uses GNU-only sort -V;
replace it with a portable bash numeric comparator by adding a version_leq()
helper and updating compare_versions to call it. Implement version_leq to split
versions on dots (and strip non-numeric suffixes if needed), compare each
segment numerically with zero-padding missing segments, and return 0 when left
<= right; then have compare_versions call version_leq(local_ver, upstream_ver)
to return 0 for equal, 1 if local older, and 2 if local newer. Ensure you keep
the same function names (compare_versions and version_leq) so callers remain
valid and avoid external commands like sort -V to guarantee cross-platform
behavior.

Comment on lines +68 to +77
### Humanising Content

Use `/humanise` or `content/humanise.md` to remove AI writing patterns:
- Inflated significance and promotional language
- Vague attributions and weasel words
- AI vocabulary (delve, tapestry, landscape, etc.)
- Rule of three, negative parallelisms
- Em dash overuse, excessive hedging

The humanise subagent is adapted from [blader/humanizer](https://github.com/blader/humanizer), based on Wikipedia's "Signs of AI writing" guide.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Quick Reference workflow still omits the Humanise step.

The top workflow list still shows Optimize as step 4, which conflicts with the new Humanise step. Please update it for consistency.

🛠️ Suggested update to the Quick Reference workflow list
-4. Optimize (SEO, readability)
-5. Publish (via WordPress or CMS)
+4. Humanise (remove AI patterns, add voice)
+5. Optimize (SEO, readability)
+6. Publish (via WordPress or CMS)
🤖 Prompt for AI Agents
In @.agent/content.md around lines 68 - 77, The Quick Reference workflow list at
the top of .agent/content.md is inconsistent with the new "Humanising Content"
section: it still lists "Optimize" as step 4 and omits the Humanise step. Update
the Quick Reference workflow list to include the Humanise step (referencing the
/humanise command or content/humanise.md) and renumber the subsequent steps so
"Optimize" follows the Humanise step; ensure the list labels and ordering match
the "Humanising Content" header and its description.

Comment on lines +247 to +256
### 16. Title Case in Headings

**Problem:** AI chatbots capitalise all main words in headings.

**Before:**
> ## Strategic Negotiations And Global Partnerships

**After:**
> ## Strategic negotiations and global partnerships

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add blank lines around blockquote headings (MD022).

Markdownlint/Codacy flags the headings inside blockquotes as missing surrounding blank lines.

🛠️ Add blank blockquote lines around the headings
 **Before:**
-> ## Strategic Negotiations And Global Partnerships
+>
+> ## Strategic Negotiations And Global Partnerships
+>
 
 **After:**
-> ## Strategic negotiations and global partnerships
+>
+> ## Strategic negotiations and global partnerships
+>
📝 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
### 16. Title Case in Headings
**Problem:** AI chatbots capitalise all main words in headings.
**Before:**
> ## Strategic Negotiations And Global Partnerships
**After:**
> ## Strategic negotiations and global partnerships
### 16. Title Case in Headings
**Problem:** AI chatbots capitalise all main words in headings.
**Before:**
>
> ## Strategic Negotiations And Global Partnerships
>
**After:**
>
> ## Strategic negotiations and global partnerships
>
🧰 Tools
🪛 GitHub Check: Codacy Static Code Analysis

[notice] 252-252: .agent/content/humanise.md#L252
Expected: 1; Actual: 0; Above


[notice] 255-255: .agent/content/humanise.md#L255
Expected: 1; Actual: 0; Above

🪛 markdownlint-cli2 (0.18.1)

252-252: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)


255-255: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
In @.agent/content/humanise.md around lines 247 - 256, The blockquote heading in
the "16. Title Case in Headings" section is missing surrounding blank lines
(triggering MD022); edit .agent/content/humanise.md around the heading that
contains "> ## Strategic negotiations and global partnerships" (or any
blockquote heading) and add a blank line immediately before the blockquote line
and a blank line immediately after the blockquote block so the blockquote
heading is separated from adjacent paragraphs; ensure other blockquote headings
in that section follow the same pattern.

Comment on lines +86 to +103
# Compare versions
compare_versions() {
local local_ver="$1"
local upstream_ver="$2"

if [[ "$local_ver" == "$upstream_ver" ]]; then
return 0 # Same version
fi

# Use sort -V for version comparison
local lowest
lowest=$(printf '%s\n%s' "$local_ver" "$upstream_ver" | sort -V | head -1)
if [[ "$lowest" == "$local_ver" ]]; then
return 1 # Local is older
else
return 2 # Local is newer (shouldn't happen normally)
fi
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Check if the file exists and read the relevant lines
if [ -f ".agent/scripts/humanise-update-helper.sh" ]; then
    echo "=== File found. Reading lines 86-103 ==="
    sed -n '86,103p' ".agent/scripts/humanise-update-helper.sh"
else
    echo "File not found"
fi

Repository: marcusquinn/aidevops

Length of output: 596


🏁 Script executed:

# Test sort -V availability and behavior
echo "=== Testing sort -V support ==="
if sort -V </dev/null >/dev/null 2>&1; then
    echo "sort -V is supported in this environment"
else
    echo "sort -V is NOT supported in this environment"
fi

# Show sort version/help info
echo ""
echo "=== Sort version info ==="
sort --version 2>&1 | head -1 || sort -h 2>&1 | head -5

Repository: marcusquinn/aidevops

Length of output: 188


🏁 Script executed:

# Test the proposed bash-only version comparison function
bash << 'EOF'
echo "=== Testing proposed version_leq function ==="

# The proposed function from review
version_leq() {
    local IFS=.
    local -a a=($1) b=($2)
    local i max=$(( ${`#a`[@]} > ${`#b`[@]} ? ${`#a`[@]} : ${`#b`[@]} ))
    for ((i=0; i<max; i++)); do
        local ai=${a[i]:-0} bi=${b[i]:-0}
        if ((10#$ai < 10#$bi)); then return 0; fi
        if ((10#$ai > 10#$bi)); then return 1; fi
    done
    return 0
}

# Test cases
test_version() {
    local v1="$1" v2="$2" expected="$3"
    if version_leq "$v1" "$v2"; then
        result=0
    else
        result=1
    fi
    
    if [[ "$result" == "$expected" ]]; then
        echo "✓ version_leq '$v1' '$v2' = $result (expected)"
    else
        echo "✗ version_leq '$v1' '$v2' = $result (expected $expected)"
    fi
}

# Run tests
test_version "1.0.0" "1.0.1" "0"  # 1.0.0 <= 1.0.1 should be true (0)
test_version "1.0.1" "1.0.0" "1"  # 1.0.1 <= 1.0.0 should be false (1)
test_version "1.0.0" "1.0.0" "0"  # 1.0.0 <= 1.0.0 should be true (0)
test_version "2.0.0" "1.9.9" "1"  # 2.0.0 <= 1.9.9 should be false (1)
test_version "1.0" "1.0.0" "0"    # 1.0 <= 1.0.0 should be true (0)
test_version "1.0.0.1" "1.0.0.2" "0"  # 1.0.0.1 <= 1.0.0.2 should be true (0)
EOF

Repository: marcusquinn/aidevops

Length of output: 381


🏁 Script executed:

# Check the full context around lines 86-103 to understand usage
if [ -f ".agent/scripts/humanise-update-helper.sh" ]; then
    echo "=== Full function context (lines 80-110) ==="
    sed -n '80,110p' ".agent/scripts/humanise-update-helper.sh"
fi

Repository: marcusquinn/aidevops

Length of output: 858


Replace sort -V with cross-platform version comparison.

The sort -V flag is GNU-specific and unavailable on macOS and BSD systems, breaking version checks on common developer machines. This violates the cross-platform reliability requirement for automation scripts. Implement the bash-only version_leq() function shown below:

Portable version comparison without GNU dependency
+version_leq() {
+    local IFS=.
+    local -a a=($1) b=($2)
+    local i max=$(( ${`#a`[@]} > ${`#b`[@]} ? ${`#a`[@]} : ${`#b`[@]} ))
+    for ((i=0; i<max; i++)); do
+        local ai=${a[i]:-0} bi=${b[i]:-0}
+        if ((10#$ai < 10#$bi)); then return 0; fi
+        if ((10#$ai > 10#$bi)); then return 1; fi
+    done
+    return 0
+}
+
 # Compare versions
 compare_versions() {
     local local_ver="$1"
     local upstream_ver="$2"
     
     if [[ "$local_ver" == "$upstream_ver" ]]; then
         return 0  # Same version
     fi
     
-    # Use sort -V for version comparison
-    local lowest
-    lowest=$(printf '%s\n%s' "$local_ver" "$upstream_ver" | sort -V | head -1)
-    if [[ "$lowest" == "$local_ver" ]]; then
-        return 1  # Local is older
-    else
-        return 2  # Local is newer (shouldn't happen normally)
-    fi
+    if version_leq "$local_ver" "$upstream_ver"; then
+        return 1  # Local is older
+    else
+        return 2  # Local is newer (shouldn't happen normally)
+    fi
 }
📝 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
# Compare versions
compare_versions() {
local local_ver="$1"
local upstream_ver="$2"
if [[ "$local_ver" == "$upstream_ver" ]]; then
return 0 # Same version
fi
# Use sort -V for version comparison
local lowest
lowest=$(printf '%s\n%s' "$local_ver" "$upstream_ver" | sort -V | head -1)
if [[ "$lowest" == "$local_ver" ]]; then
return 1 # Local is older
else
return 2 # Local is newer (shouldn't happen normally)
fi
}
version_leq() {
local IFS=.
local -a a=($1) b=($2)
local i max=$(( ${`#a`[@]} > ${`#b`[@]} ? ${`#a`[@]} : ${`#b`[@]} ))
for ((i=0; i<max; i++)); do
local ai=${a[i]:-0} bi=${b[i]:-0}
if ((10#$ai < 10#$bi)); then return 0; fi
if ((10#$ai > 10#$bi)); then return 1; fi
done
return 0
}
# Compare versions
compare_versions() {
local local_ver="$1"
local upstream_ver="$2"
if [[ "$local_ver" == "$upstream_ver" ]]; then
return 0 # Same version
fi
if version_leq "$local_ver" "$upstream_ver"; then
return 1 # Local is older
else
return 2 # Local is newer (shouldn't happen normally)
fi
}
🤖 Prompt for AI Agents
In @.agent/scripts/humanise-update-helper.sh around lines 86 - 103, The
compare_versions function uses GNU-only sort -V; replace it with a portable bash
numeric comparator by adding a version_leq() helper and updating
compare_versions to call it. Implement version_leq to split versions on dots
(and strip non-numeric suffixes if needed), compare each segment numerically
with zero-padding missing segments, and return 0 when left <= right; then have
compare_versions call version_leq(local_ver, upstream_ver) to return 0 for
equal, 1 if local older, and 2 if local newer. Ensure you keep the same function
names (compare_versions and version_leq) so callers remain valid and avoid
external commands like sort -V to guarantee cross-platform behavior.

Comment on lines +182 to +195
cmd_diff() {
local subagent_file="$LOCAL_SUBAGENT"
if [[ -f "$SOURCE_SUBAGENT" ]]; then
subagent_file="$SOURCE_SUBAGENT"
fi

if ! fetch_upstream; then
return 1
fi

if [[ ! -f "$CACHE_FILE" ]]; then
echo -e "${RED}No cached upstream file. Run 'check' first.${NC}"
return 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fail fast when the local subagent file is missing in diff.

Right now diff can succeed with an empty/invalid comparison because errors are masked by || true. Add an explicit existence check so the command returns non-zero and a clear message. As per coding guidelines, enforce reliable exit codes and diagnostics in automation scripts.

🛠️ Add missing-file guard
     local subagent_file="$LOCAL_SUBAGENT"
     if [[ -f "$SOURCE_SUBAGENT" ]]; then
         subagent_file="$SOURCE_SUBAGENT"
     fi
+
+    if [[ ! -f "$subagent_file" ]]; then
+        echo -e "${RED}Humanise subagent not found at: ${subagent_file}${NC}"
+        return 1
+    fi
     
     if ! fetch_upstream; then
         return 1
     fi
📝 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
cmd_diff() {
local subagent_file="$LOCAL_SUBAGENT"
if [[ -f "$SOURCE_SUBAGENT" ]]; then
subagent_file="$SOURCE_SUBAGENT"
fi
if ! fetch_upstream; then
return 1
fi
if [[ ! -f "$CACHE_FILE" ]]; then
echo -e "${RED}No cached upstream file. Run 'check' first.${NC}"
return 1
fi
cmd_diff() {
local subagent_file="$LOCAL_SUBAGENT"
if [[ -f "$SOURCE_SUBAGENT" ]]; then
subagent_file="$SOURCE_SUBAGENT"
fi
if [[ ! -f "$subagent_file" ]]; then
echo -e "${RED}Humanise subagent not found at: ${subagent_file}${NC}"
return 1
fi
if ! fetch_upstream; then
return 1
fi
if [[ ! -f "$CACHE_FILE" ]]; then
echo -e "${RED}No cached upstream file. Run 'check' first.${NC}"
return 1
fi
🤖 Prompt for AI Agents
In @.agent/scripts/humanise-update-helper.sh around lines 182 - 195, cmd_diff
currently can proceed when the chosen subagent file is missing, masking errors;
add an explicit existence guard after resolving subagent_file (the variable set
from LOCAL_SUBAGENT or SOURCE_SUBAGENT in cmd_diff) that checks [[ -f
"$subagent_file" ]] and, if missing, prints a clear error referencing the
missing file and returns non-zero (return 1) so the script fails fast; ensure
this check is placed before any operations that rely on the file and keeps the
existing CACHE_FILE check intact.

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.

2 participants