feat(update): hint at bitsocial logs --stdout after restarting daemons#56
feat(update): hint at bitsocial logs --stdout after restarting daemons#56Rinse12 wants to merge 1 commit into
bitsocial logs --stdout after restarting daemons#56Conversation
When `bitsocial update install` installs a new version and restarts the previously-running daemon(s), the user loses access to the old daemon's stdout (which contains the web UI links). Point them at `bitsocial logs --stdout` so they can recover that output from the new daemon.
📝 WalkthroughWalkthroughThe install command now prints a user-facing instruction to view daemon logs via ChangesDaemon restart logging hint
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/cli/commands/update/install.tsOops! Something went wrong! :( ESLint: 8.27.0 Error: ESLint configuration in --config » eslint-config-oclif is invalid:
Referenced from: /.eslintrc 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with 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.
Inline comments:
In `@src/cli/commands/update/install.ts`:
- Around line 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.
- 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).
🪄 Autofix (Beta)
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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 50a82e2c-870e-46df-a6cd-6b7af9f12d1c
📒 Files selected for processing (1)
src/cli/commands/update/install.ts
| if (aliveDaemons.length > 0 && flags["restart-daemons"]) { | ||
| await this._restartDaemons(aliveDaemons); | ||
| this.log("To see the daemon logs run `bitsocial logs --stdout`"); | ||
| } |
There was a problem hiding this comment.
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.
| // 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`"); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
npm run build && npm run build:testRepository: 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:testRepository: 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).
Summary
bitsocial update installinstalls a new version and restarts the previously-running daemon(s), print a one-line hint pointing the user atbitsocial logs --stdout.stdio: "ignore", so the user loses visibility on the web UI links and other stdout output from the old daemon. This hint shows them how to recover that output from the new daemon.The message only fires when a new version was actually installed AND daemons were running (i.e. the user genuinely lost stdout access). It is suppressed on the "already on this version" path and when no daemons were running.
Closes #55
Test plan
bitsocial update install <newer-version>with a running daemon and confirm the hint appears after the restart block.bitsocial update install <same-version>with a running daemon and confirm the hint does NOT appear (no new install happened).bitsocial update install <newer-version>with no running daemon and confirm the hint does NOT appear.Summary by CodeRabbit