Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cli/commands/update/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default class Install extends Command {
// Restart daemons with the new binary
if (aliveDaemons.length > 0 && flags["restart-daemons"]) {
await this._restartDaemons(aliveDaemons);
this.log("To see the daemon logs run `bitsocial logs --stdout`");
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

🧩 Analysis chain

🏁 Script executed:

npm run build && npm run build:test

Repository: bitsocialnet/bitsocial-cli

Length of output: 4785


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== node_modules present? =="
if [ -d node_modules ]; then echo "yes"; else echo "no"; fi

echo "== lockfiles present? =="
ls -1 package-lock.json npm-shrinkwrap.json yarn.lock pnpm-lock.yaml 2>/dev/null || true

echo "== installing deps (prefer npm ci) =="
if [ -f package-lock.json ]; then
  npm ci
else
  npm install
fi

echo "== rerun mandated checks =="
npm run build && npm run build:test

Repository: bitsocialnet/bitsocial-cli

Length of output: 2962


Mandated TS build checks currently fail (npm run build && npm run build:test)
npm install runs node bin/postinstall.js and fails with ERROR: No web UIs were downloaded. At least one web UI is required. Even after that, tsc --project config/tsconfig.json reports many TS2307: Cannot find module ... errors, so the build/test command can’t pass in this environment.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/commands/update/install.ts` at line 133, Build fails because
bin/postinstall.js aborts when no web UIs are present and tsc errors out from
missing modules; change bin/postinstall.js so it logs a warning instead of
throwing/exit(1) when "No web UIs were downloaded" (make the check non-fatal),
and update config/tsconfig.json to reduce spurious module errors (e.g., enable
"skipLibCheck": true and ensure "typeRoots"/"paths" include the project's types
or add the missing devDependencies to package.json) so npm run build && npm run
build:test can complete in CI/dev environments; target changes in
bin/postinstall.js and config/tsconfig.json (and package.json devDependencies or
build scripts if needed).

}
Comment on lines 131 to 134
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

Add an automated test for the new hint gating behavior.

This feature change needs a test that proves the hint appears only when a new version is installed and daemons were restarted, and stays hidden in the two negative cases.

As per coding guidelines, "Add a test when you add a feature or fix a bug".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/commands/update/install.ts` around lines 131 - 134, Add an automated
test covering the new hint gating: create three small tests for the install
command that simulate (1) new version installed AND daemons restarted -> expect
the hint "To see the daemon logs run `bitsocial logs --stdout`" to be logged;
(2) new version installed BUT daemons not restarted -> expect the hint NOT
logged; (3) daemons restarted BUT no new version installed -> expect the hint
NOT logged. In each test, stub/memoize the pieces used in the install flow: mock
the installation result (simulate newVersionInstalled true/false), set
aliveDaemons (non-empty or empty), control flags["restart-daemons"], spy on the
command's this.log, and stub _restartDaemons to avoid real restarts while still
marking it called. Use the exact symbols aliveDaemons, flags["restart-daemons"],
_restartDaemons, and the hint string to locate and assert behavior.

}

Expand Down
Loading