Skip to content

chore: simplify postinstall to advise running aidevops update#82

Merged
marcusquinn merged 1 commit intomainfrom
chore/postinstall-update-advice
Jan 14, 2026
Merged

chore: simplify postinstall to advise running aidevops update#82
marcusquinn merged 1 commit intomainfrom
chore/postinstall-update-advice

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Jan 14, 2026

Summary

  • Simplify npm postinstall script to show version info and advise aidevops update
  • Remove failed attempt to run setup.sh (which doesn't work without .agent/ folder)

Why

The npm package only contains the CLI wrapper, not the full .agent/ folder with agents. The previous postinstall tried to run setup.sh which would fail silently.

New Install Flow

$ npm install -g aidevops

aidevops CLI installed successfully!

  CLI version:    2.54.4
  Agents version: not installed

To complete installation, run:

  aidevops update

This will clone the repository and deploy agents to ~/.aidevops/agents/

Update Flow

$ npm install -g aidevops

aidevops CLI installed successfully!

  CLI version:    2.54.4
  Agents version: 2.54.3

To update agents to match CLI version, run:

  aidevops update

When In Sync

aidevops CLI installed successfully!

  CLI version:    2.54.4
  Agents version: 2.54.4

CLI and agents are in sync. Ready to use!

Quick start:
  aidevops status    # Check installation
  aidevops init      # Initialize in a project
  aidevops help      # Show all commands

Summary by CodeRabbit

Chores

  • Enhanced version status messaging to clearly indicate when CLI and agents are in sync or out of sync
  • Simplified installation flow with improved prompts to run updates when versions don't align
  • Better user guidance for deployment and keeping components synchronized

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

The npm package only contains the CLI wrapper, not the full agent files.
Instead of trying to run setup.sh (which fails without .agent/ folder),
show version comparison and advise running 'aidevops update' to:
- Clone the repo if not present
- Pull latest changes if repo exists
- Run setup.sh to deploy agents

This makes the install flow clearer:
1. npm install -g aidevops  (installs CLI)
2. aidevops update          (deploys agents)
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2026

Walkthrough

The npm postinstall script is refactored to use a simpler version-checking mechanism. Instead of executing setup.sh, it now reads the installed version from ~/.aidevops/agents/VERSION and compares it against the package.json version, providing appropriate messaging based on sync status.

Changes

Cohort / File(s) Summary
Install Flow Simplification
scripts/npm-postinstall.cjs
Replaced setup.sh execution with VERSION file-based version checking. Reads installed version from ~/.aidevops/agents/VERSION (or defaults to 'not installed'), compares against package.json, and outputs conditional messaging: uninstalled state prompts aidevops update with deployment info; version mismatch suggests update; matching versions confirm sync and show quick-start commands. Removes error handling for non-critical setup issues.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🔄 Version dance, no setup call,
Just a VERSION file on the wall,
Package and agents, now in harmony,
Simplicity reigns—pure DevOps symphony! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: simplifying the postinstall script to advise running aidevops update instead of attempting setup.sh execution.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
scripts/npm-postinstall.cjs (1)

15-19: Consider defensive error handling for file read.

The existsSync check is good, but readFileSync can still throw on permission errors or if the file is deleted between check and read. For a postinstall script, this is low-risk, but wrapping in try-catch would make it bulletproof.

🛡️ Optional: Add try-catch for robustness
 // Check current installed version
 let installedVersion = 'not installed';
-if (fs.existsSync(versionFile)) {
-    installedVersion = fs.readFileSync(versionFile, 'utf8').trim();
+try {
+    if (fs.existsSync(versionFile)) {
+        installedVersion = fs.readFileSync(versionFile, 'utf8').trim();
+    }
+} catch {
+    // Keep default 'not installed' on any read error
 }

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3161d7b and 649d696.

📒 Files selected for processing (1)
  • scripts/npm-postinstall.cjs
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-06T15:57:56.027Z
Learning: Applies to **/setup.sh : Deploy agents locally using ./setup.sh script
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-06T15:57:56.027Z
Learning: Applies to **/.agent/scripts/version-manager.sh : Use .agent/scripts/version-manager.sh release [major|minor|patch] for releases
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: templates/home/AGENTS.md:0-0
Timestamp: 2025-12-22T01:24:53.937Z
Learning: Follow all security protocols and working directory specifications defined in ~/Git/aidevops/AGENTS.md
📚 Learning: 2026-01-06T15:57:56.027Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-06T15:57:56.027Z
Learning: Applies to **/setup.sh : Deploy agents locally using ./setup.sh script

Applied to files:

  • scripts/npm-postinstall.cjs
📚 Learning: 2025-12-22T01:24:53.937Z
Learnt from: CR
Repo: marcusquinn/aidevops PR: 0
File: templates/home/AGENTS.md:0-0
Timestamp: 2025-12-22T01:24:53.937Z
Learning: Follow all security protocols and working directory specifications defined in ~/Git/aidevops/AGENTS.md

Applied to files:

  • scripts/npm-postinstall.cjs
🧬 Code graph analysis (1)
scripts/npm-postinstall.cjs (1)
.agent/scripts/ahrefs-mcp-wrapper.js (1)
  • require (25-25)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (3)
scripts/npm-postinstall.cjs (3)

1-10: LGTM! Clean documentation and minimal imports.

The updated header accurately documents the simplified flow—npm package ships the CLI wrapper, agents are deployed via aidevops update. Import set is lean and appropriate for the file operations needed.


21-23: LGTM! Standard pattern for package version retrieval.

Using require('../package.json') is the idiomatic way to read the package version in Node.js. If this fails, the package itself is malformed—appropriate to surface that error.


32-51: LGTM! Clear, actionable user guidance.

The three-way branching handles all installation states cleanly:

  • Fresh install → guides to aidevops update with explanation
  • Version mismatch → prompts update to sync
  • In sync → confirms readiness with quick-start hints

This is a significant UX improvement over the previous approach of attempting setup.sh execution, which could fail silently or confusingly when the .agent/ folder isn't present. Well done on the simplification!

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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 streamlines the post-installation process for the aidevops CLI. It addresses issues where the npm postinstall script was attempting to deploy agents directly, which was not feasible given that the npm package only contains the CLI wrapper. The updated script now provides a more robust and user-friendly experience by guiding users through the necessary steps to install or update their agents using the aidevops update command, ensuring a smoother setup flow.

Highlights

  • Simplified Postinstall Script: The npm postinstall script has been refactored to simplify its logic and improve user experience.
  • Clearer Installation Guidance: The script now explicitly advises users to run aidevops update to complete the installation or synchronize agents, displaying current CLI and agent versions.
  • Removed Failed Setup Attempt: The previous, problematic attempt to run setup.sh directly from the postinstall script has been removed, as it often failed due to missing agent folders.
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.

@sonarqubecloud
Copy link

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 simplifies the npm postinstall script to provide clearer guidance to users after installation. The previous approach of running setup.sh was flawed and has been replaced with a script that checks the installed agent version and advises the user to run aidevops update if necessary. This is a significant improvement to the user installation experience. I have one suggestion to make the script more robust against potential file system errors.

Comment on lines +17 to 19
if (fs.existsSync(versionFile)) {
installedVersion = fs.readFileSync(versionFile, 'utf8').trim();
}

Choose a reason for hiding this comment

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

medium

The script could be more robust by handling potential errors when reading the version file. While fs.existsSync checks for the file, fs.readFileSync could still fail due to permissions or other file system issues. An unhandled exception would print a stack trace, which is not ideal for a post-install script. Wrapping this logic in a try...catch block would gracefully handle such errors and improve the user experience.

try {
    if (fs.existsSync(versionFile)) {
        installedVersion = fs.readFileSync(versionFile, 'utf8').trim();
    }
} catch (error) {
    // If reading the version fails, we can't determine the version.
    // We'll proceed as if it's not installed and log a warning.
    console.warn(`aidevops: Could not read agents version file: ${error.message}`);
}

@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, 260 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Jan 14 02:28:17 UTC 2026: Code review monitoring started
Wed Jan 14 02:28:17 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 260
Wed Jan 14 02:28:17 UTC 2026: Qlty - 0 issues found, auto-formatting applied
Wed Jan 14 02:28:19 UTC 2026: Codacy analysis completed with auto-fixes

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 260
  • VULNERABILITIES: 0

Generated on: Wed Jan 14 02:28:58 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@augmentcode
Copy link

augmentcode bot commented Jan 14, 2026

🤖 Augment PR Summary

Summary: Simplifies the npm postinstall behavior so installs don’t attempt to deploy agents automatically.

Changes: Prints CLI version and detected agents version (from ~/.aidevops/agents/VERSION), then guides users to run aidevops update when agents are missing or out of sync; otherwise shows quick-start commands.

Why: The published npm package only includes the CLI wrapper, so running setup.sh during postinstall was unreliable without the full agent repository contents.

🤖 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. 1 suggestions posted.

Fix All in Augment

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

// Check current installed version
let installedVersion = 'not installed';
if (fs.existsSync(versionFile)) {
installedVersion = fs.readFileSync(versionFile, 'utf8').trim();
Copy link

Choose a reason for hiding this comment

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

fs.readFileSync(versionFile, ...) can still throw even if existsSync returned true (e.g., permission issues/broken symlink), which would fail the entire npm install because this postinstall script isn’t guarded. Consider wrapping version detection in a try/catch and falling back to not installed to keep installs resilient.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

@marcusquinn marcusquinn merged commit fba89d4 into main Jan 14, 2026
14 of 16 checks passed
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