Skip to content

feat(update): hint at bitsocial logs --stdout after restarting daemons#56

Open
Rinse12 wants to merge 1 commit into
masterfrom
feat/update-install-hint-stdout-logs
Open

feat(update): hint at bitsocial logs --stdout after restarting daemons#56
Rinse12 wants to merge 1 commit into
masterfrom
feat/update-install-hint-stdout-logs

Conversation

@Rinse12
Copy link
Copy Markdown
Member

@Rinse12 Rinse12 commented May 25, 2026

Summary

  • After bitsocial update install installs a new version and restarts the previously-running daemon(s), print a one-line hint pointing the user at bitsocial logs --stdout.
  • The restart spawns the new daemon detached with 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

  • Manually run bitsocial update install <newer-version> with a running daemon and confirm the hint appears after the restart block.
  • Run bitsocial update install <same-version> with a running daemon and confirm the hint does NOT appear (no new install happened).
  • Run bitsocial update install <newer-version> with no running daemon and confirm the hint does NOT appear.

Summary by CodeRabbit

  • New Features
    • Added a user-facing instruction message that appears during daemon restarts after CLI updates, directing users to the daemon log command for additional information.

Review Change Stack

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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

📝 Walkthrough

Walkthrough

The install command now prints a user-facing instruction to view daemon logs via bitsocial logs --stdout immediately before restarting daemons after successful installation or upgrade. This guides users to discover daemon output since the new daemon is spawned detached with suppressed stdio.

Changes

Daemon restart logging hint

Layer / File(s) Summary
Daemon restart log instruction
src/cli/commands/update/install.ts
A single log message is added before the daemon restart call, instructing users to run bitsocial logs --stdout to view daemon logs and runtime output after the update completes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit hops to share a helpful tip,
"Logs await you with a simple quip!"
When daemons restart and stdout fades away,
bitsocial logs --stdout lights the way. 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(update): hint at bitsocial logs --stdout after restarting daemons' accurately and concisely describes the main change—adding a user-facing hint after daemon restarts.
Linked Issues check ✅ Passed The PR implements all coding requirements from issue #55: prints the hint only when a new version is installed AND daemons were running, directing users to recover lost stdout via the logs command.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the stated objective—adding a conditional hint message before daemon restart with no unrelated modifications.
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
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/update-install-hint-stdout-logs

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/cli/commands/update/install.ts

Oops! Something went wrong! :(

ESLint: 8.27.0

Error: ESLint configuration in --config » eslint-config-oclif is invalid:

  • Unexpected top-level property "__esModule".

Referenced from: /.eslintrc
at ConfigValidator.validateConfigSchema (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2156:19)
at ConfigArrayFactory._normalizeConfigData (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2998:19)
at ConfigArrayFactory._loadConfigData (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2963:21)
at ConfigArrayFactory._loadExtendedShareableConfig (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3264:21)
at ConfigArrayFactory._loadExtends (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3135:25)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3074:25)
at _normalizeObjectConfigDataBody.next ()
at ConfigArrayFactory._normalizeObjectConfigData (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3019:20)
at _normalizeObjectConfigData.next ()
at ConfigArrayFactory.loadFile (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2829:16)


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.

Copy link
Copy Markdown

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

📥 Commits

Reviewing files that changed from the base of the PR and between 95aec49 and 2df026a.

📒 Files selected for processing (1)
  • src/cli/commands/update/install.ts

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

// 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).

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.

Print 'bitsocial logs --stdout' hint after update install restarts daemons

1 participant