Skip to content

CLI onboarding UX, colored output, build + docs cleanup#984

Open
rohitg00 wants to merge 6 commits into
mainfrom
fix/engine-conflict-dx-and-warnings
Open

CLI onboarding UX, colored output, build + docs cleanup#984
rohitg00 wants to merge 6 commits into
mainfrom
fix/engine-conflict-dx-and-warnings

Conversation

@rohitg00

@rohitg00 rohitg00 commented Jun 27, 2026

Copy link
Copy Markdown
Owner

What

  • First-run UX: clearer, actionable guidance with an honest recovery path when startup can't proceed automatically (adapts to npx vs global install).
  • Quieter boot: the no-provider-key notice is now one dim line instead of a paragraph.
  • Colored CLI output across boot, status, demo, connect, and errors. Adds picocolors to dependencies; panels stay aligned (clack strips ANSI for width) and color auto-disables on non-TTY.
  • Build warnings: migrate tsdown deps config, silence per-entry plugin-timings, make a couple of dynamic imports consistent. Only the Node 20 deprecation notice remains.
  • Docs: pin all install paths to the supported version and correct the install notes across README + 11 translations; bump deploy Dockerfile version to 0.9.27.

Notes

  • Translations were machine-regenerated for the corrected install notes; worth a native skim before relying on them.
  • Verified locally: npm run build, npm run skills:check, and the full test suite (7097) pass.

Summary by CodeRabbit

  • Bug Fixes

    • Prevented adopting an already-running engine when its version doesn’t match the pinned version; the CLI now gives clear recovery steps to stop and restart to install/run the pinned engine.
    • Safer image quota cleanup: if image reference counts can’t be determined, eviction is skipped to avoid deleting referenced images.
  • Documentation

    • Updated README guidance (all languages) with stricter upgrade warnings and pinned iiidev/iii:0.11.2 install details.
    • Refreshed the agent installation runbook with clearer port prerequisites and troubleshooting steps.
  • Chores

    • Updated deployment builds to 0.9.27.
    • Improved CLI output readability with consistent terminal coloring.

- Clearer, actionable first-run guidance with an honest recovery path when startup can't proceed automatically.
- Quieter boot: collapse the no-provider-key notice to a single dim line.
- Colored CLI output across boot, status, demo, connect, and errors (adds picocolors to deps; panels stay aligned; color auto-disables on non-TTY).
- Build warnings: migrate tsdown deps config, silence per-entry plugin-timings, make dynamic imports consistent. Only the node20 deprecation remains.
- Docs: correct install instructions and pin install paths to the supported version across README and 11 translations; bump deploy Dockerfile version to 0.9.27.
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agentmemory Ready Ready Preview, Comment Jun 27, 2026 8:49pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a startup version check for attached iii engines, applies picocolors-based CLI formatting, refactors image helper imports, updates tsdown and deploy version pins, and rewrites README guidance for the pinned v0.11.2 engine.

Changes

Pinned engine gate and release docs

Layer / File(s) Summary
Engine version compatibility gate
src/cli.ts
The CLI startup path detects the version of an already-running iii engine, compares it with IIPINNED_VERSION, and exits with remediation output when the versions are incompatible.
picocolors formatting across CLI output
package.json, src/cli.ts, src/cli/connect/index.ts, src/config.ts
The CLI, connection summaries, config warnings, and dependency update use picocolors for styled terminal output.
Image helper import refactors
src/functions/observe.ts, src/functions/image-quota-cleanup.ts
The observation path now imports image-store helpers statically, while image quota cleanup loads the image refcount helper dynamically and skips deletion when refcount lookup fails.
tsdown and deploy version updates
tsdown.config.ts, deploy/*/Dockerfile, deploy/coolify/docker-compose.yml, deploy/render/render.yaml
The tsdown shared config switches dependency handling to deps.neverBundle, disables plugin timing checks, and the deploy configuration bumps AGENTMEMORY_VERSION to 0.9.27.
Pinned engine guidance in READMEs
README.md, READMEs/README.*.md, INSTALL_FOR_AGENTS.md
The main and localized READMEs update upgrade warnings, iii-engine installation notes, and the agent installation runbook to describe the pinned v0.11.2 engine and related startup and troubleshooting guidance.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • rohitg00/agentmemory#654: Also modifies src/functions/observe.ts, overlapping with the image-handling refactor in this PR.
  • rohitg00/agentmemory#774: Modifies src/cli.ts around attached iii-engine handling and pinned version enforcement, which overlaps with the startup compatibility gate here.
  • rohitg00/agentmemory#849: Changes the same src/cli.ts version-mismatch path for already-running iii engines.

Poem

🐇 Hop-hop, the engine’s pinned in place,
Colors now bloom in every CLI trace.
The README sings of v0.11.2 bright,
And bundled paths stay tidy at night.
I nibble a carrot and give a small cheer—
Version-matched bunnies like order out here.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and matches the PR’s main themes: CLI onboarding UX, colored output, and supporting build/docs updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/engine-conflict-dx-and-warnings

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.

Align the README recovery note with the CLI: stop the other engine, then run agentmemory (installs the pinned engine). --instance does not relocate the engine's config-bound port, so it was misleading.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/functions/observe.ts (1)

154-158: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Make image save/ref updates rollback-safe.

incrementImageRef() runs before kv.set(), but the catch path calls deleteImage(raw.imageData) directly. Since deleteImage() does not check refcounts, a failed observation write can delete an existing deduped image, or leave stale refs after deleting a newly written image. Roll back the image ref first, then unlink only when no refs remain.

Also applies to: 182-183

🤖 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/functions/observe.ts` around lines 154 - 158, The image persistence flow
in observe() is not rollback-safe because incrementImageRef() happens before
kv.set() and the catch path later calls deleteImage(raw.imageData) directly.
Update the observe() write/rollback logic so that on failure it first undoes the
ref change for the saved image, then only removes the file when the refcount
drops to zero; use the existing observe(), incrementImageRef(), and
deleteImage() flow to ensure failed writes do not delete shared deduped images
or leave stale refs.
🤖 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 `@deploy/coolify/Dockerfile`:
- Line 7: The Coolify deployment still pins an older AGENTMEMORY_VERSION in the
compose override, so update the Coolify override to match the new Dockerfile
default. Adjust the value passed from the docker-compose setup used by Coolify
so builds pick up the same version as the ARG in Dockerfile, and verify the
version flow remains consistent through the compose override.

In `@deploy/render/Dockerfile`:
- Line 7: Update the version pin consistently across both deployment configs:
the change to the Dockerfile’s AGENTMEMORY_VERSION is not enough because the
Render blueprint still hardcodes the older value in render.yaml. Adjust the
AGENTMEMORY_VERSION setting in the Render blueprint to match the Dockerfile so
Render deployments use the same package version; use the AGENTMEMORY_VERSION
symbol in both files to locate the mismatch.

In `@src/cli.ts`:
- Around line 1241-1246: The compatibility check in the running-engine adoption
path relies on `whichBinary("iii")`/`fallbackIiiPaths()` and
`iiiBinVersion(...)`, which can misidentify the already-bound process and
incorrectly treat unknown versions as compatible. Update the gate around
`adoptRunningEngine()` in `src/cli.ts` to use the running engine’s own reported
version/state instead of inferring from a local binary, and make the default
behavior fail closed when version compatibility cannot be proven; also treat the
`detected === null` case as incompatible unless the running engine explicitly
confirms a supported version.

---

Outside diff comments:
In `@src/functions/observe.ts`:
- Around line 154-158: The image persistence flow in observe() is not
rollback-safe because incrementImageRef() happens before kv.set() and the catch
path later calls deleteImage(raw.imageData) directly. Update the observe()
write/rollback logic so that on failure it first undoes the ref change for the
saved image, then only removes the file when the refcount drops to zero; use the
existing observe(), incrementImageRef(), and deleteImage() flow to ensure failed
writes do not delete shared deduped images or leave stale refs.
🪄 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: 6677e752-e231-4e40-bac8-c21a4494bdfa

📥 Commits

Reviewing files that changed from the base of the PR and between f6f9e3c and 823d27b.

📒 Files selected for processing (23)
  • README.md
  • READMEs/README.de-DE.md
  • READMEs/README.es-ES.md
  • READMEs/README.fr-FR.md
  • READMEs/README.hi-IN.md
  • READMEs/README.ja-JP.md
  • READMEs/README.ko-KR.md
  • READMEs/README.pt-BR.md
  • READMEs/README.ru-RU.md
  • READMEs/README.tr-TR.md
  • READMEs/README.zh-CN.md
  • READMEs/README.zh-TW.md
  • deploy/coolify/Dockerfile
  • deploy/fly/Dockerfile
  • deploy/railway/Dockerfile
  • deploy/render/Dockerfile
  • package.json
  • src/cli.ts
  • src/cli/connect/index.ts
  • src/config.ts
  • src/functions/image-quota-cleanup.ts
  • src/functions/observe.ts
  • tsdown.config.ts

Comment thread deploy/coolify/Dockerfile
Comment thread deploy/render/Dockerfile
Comment thread src/cli.ts
Install runbook now uses npm install -g @agentmemory/agentmemory@latest (agent + future sessions get newest), removes the misleading --instance/--port port suggestions (neither relocates the config-bound engine), and adds an engine-conflict troubleshooting step (stop the other engine, re-run, pinned engine installs into ~/.agentmemory/bin).
- cli.ts: only adopt a running engine when its version positively matches the pin; treat unknown/unverifiable as incompatible (fail closed) instead of adopting and risking a reconnect loop. Message handles the unknown-version case.
- observe.ts: on a failed observation write, roll back via decrementImageRef (deletes the file only when no other observation references it) instead of deleteImage, so a failed write can't orphan a deduped image or leave a stale ref.
- deploy: bump AGENTMEMORY_VERSION to 0.9.27 in the Coolify compose override and the Render blueprint to match the Dockerfile default.
- observe.ts: wrap the image-ref rollback in try/catch and log on failure so the original observation-write error is still thrown (not masked by a rollback error).
- INSTALL_FOR_AGENTS: port-conflict bullet now lists 3112/3113 too (matches prerequisites).
- README: engine-conflict note uses npx -y ...@latest (matches the runbook).
- Drop redundant @latest from npm install -g (global install already resolves latest); keep @latest only on npx, which caches per version.
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