Skip to content

feat(desktop): the Mac app gives its agents the j5 command - #418

Merged
Jacksondr5 merged 1 commit into
j5/cli-agent-pathfrom
j5/cli-desktop-command
Oct 4, 2026
Merged

Jacksondr5 merged 1 commit into
j5/cli-agent-pathfrom
j5/cli-desktop-command

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Stack 5/5. Depends on #417.

Problem

Agents run by the Mac app couldn't call j5: the app installed no CLI, and its agents only had one if the person had installed the command-line version too. Part of #397.

What changed

At each launch, after it installs the login shell's environment and before its backend starts, the packaged macOS app:

  • Writes the script. ~/.j5code/bin/j5 runs ELECTRON_RUN_AS_NODE=1 exec <app executable> <app.asar>/apps/server/dist/bin.mjs "$@", the way the app already starts its own server. It's rewritten every launch, so it follows the app if the app moves, and it says so plainly if the app has been deleted.
  • Its server does the rest. The app's server finds the script and puts ~/.j5code/bin first on its agents' PATH (feat(server): agents can run the server's own j5 #417), the directory a release server uses for its own j5. The app doesn't set PATH itself: its server rebuilds PATH from the login shell, which would push the directory behind the person's own.

It leaves the person's setup alone. No command is put on their PATH and no shell startup file is edited. Most desktop apps never edit shell files, and the few that do have a record of bugs from it. An in-app command to install j5 for the person's own terminal, as VS Code offers, is #441. Until then a desktop-only user can run ~/.j5code/bin/j5.

The app's server runs exactly as before. The step is skipped in development and off macOS, where J5 ships no desktop build.

How it was checked.

  • Signed Mac app: on 2026-10-03 the signed, notarized 0.0.47 app ran this exact command from a terminal: --version, --help, project add and project rename against a server, each exit 0, with no Dock icon or dialogs.
  • The script: run for real in a test, with a space and a quote in the app path, and again after the app is removed.

The startup step itself hasn't run in a packaged build.

Upstream impact

  • Code:
    • apps/desktop/src/app/DesktopApp.ts: one call after installIntoProcess, into J5-owned apps/desktop/src/j5/desktopCli.ts.
    • packages/shared/package.json: one export appended.
  • Records: FORK.md case 54, with file-table rows. Register entry D28 is extended.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior: desktopCli.test.ts in desktop (the script; nothing written outside the J5 home; a server link replaced without touching its target; nothing in a development build); the shared script test; agentPath.test.ts in feat(server): agents can run the server's own j5 #417 (the server putting the script's directory first)
  • UI changes: none (no window, menu or setting changes)
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row)
  • Upstream product: Jackson's request on The j5 CLI isn't reachable after install: not on PATH, and the desktop app doesn't provide it #397, narrowed on 2026-10-03; register entry D28
  • Surfaces: packaged macOS app only. The person's own terminal is deliberately left for the in-app command.
  • Docs: docs/user/install.md says agents get j5 and how to run it yourself

Built by Claude Opus 5.5 (1M context) in Claude Code.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
j5-code Ready Ready Preview Oct 4, 2026 10:31pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 9 billable files and costs up to $2.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 59 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 51 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: Jacksondr5/j5code/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: ff156968-4d48-44c5-b6e5-5384412a6f6e
📥 Commits

Reviewing files that changed from the base of the PR and between fef2b14 and 9783af8.

📒 Files selected for processing (9)
  • FORK.md
  • apps/desktop/src/app/DesktopApp.ts
  • apps/desktop/src/j5/desktopCli.test.ts
  • apps/desktop/src/j5/desktopCli.ts
  • docs/j5/product/upstream.md
  • docs/user/install.md
  • packages/shared/package.json
  • packages/shared/src/j5/desktopCli.test.ts
  • packages/shared/src/j5/desktopCli.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 effective changed lines (test files excluded in mixed PRs). labels Oct 3, 2026
@Jacksondr5
Jacksondr5 force-pushed the j5/cli-desktop-command branch from feb2457 to c509b3a Compare October 3, 2026 01:41
@Jacksondr5

Copy link
Copy Markdown
Owner Author

Review panel (Opus 5.5 code review, Astra live test). Findings on this PR, verified by the builder and fixed in c509b3a303:

  • One failure skipped agents' PATH (should-fix, Opus). The three steps ran as one effect, so a failed profile or script write skipped the PATH change agents need. The PATH change now comes first, and each step is independent. Covered by a new test with a read-only .zshrc.
  • Whole-profile rewrite (should-fix, Opus). The app rewrote the whole profile after a read that turned any error into an empty file. It now appends its line, and leaves the profile alone on any read error but a missing file.
  • Profile choice (bug, Opus and Astra). The app now uses the same corrected choice as feat(cli): the installer puts j5 on your PATH #416: macOS bash's existing login file, and fish under XDG_CONFIG_HOME with --path. Covered by a new test with an existing .profile.
  • Linux AppImage (nit, Opus). The step now runs on macOS only, where J5 ships its desktop app; on Linux an AppImage would have pointed the script into a temporary mount.
  • Duplicated check (nit, Opus). The "is this the app's own script" check was duplicated between the app and j5 uninstall; it's now one shared inspectDesktopCliCommand.

Noted, not changed (nit, Opus). j5 uninstall removes the PATH line and the desktop script whatever --base-dir it's run with; the app re-adds both at its next launch. That's left as is.

Not run. The packaged startup step hasn't run in a real app build; Astra reviewed the code and ran its tests.

@Jacksondr5

Copy link
Copy Markdown
Owner Author

Review panel, second pass (Opus 5.5, Astra). This PR is now a single commit, f610d80e20:

Still not run: the app's startup step in a packaged build.

@github-actions github-actions Bot added size:M 30-99 effective changed lines (test files excluded in mixed PRs). and removed size:L 100-499 effective changed lines (test files excluded in mixed PRs). labels Oct 3, 2026
@Jacksondr5
Jacksondr5 force-pushed the j5/cli-desktop-command branch from f610d80 to e02faea Compare October 4, 2026 21:29
@Jacksondr5
Jacksondr5 force-pushed the j5/cli-desktop-command branch from e02faea to 5249702 Compare October 4, 2026 21:38
Agents run by the Mac app couldn't call `j5`: the app installed no CLI. At
each launch the packaged macOS app now writes a script that runs its
bundled CLI to `<home>/bin/j5`, the directory a release server uses for its
own `j5`. The app's server finds it there and puts that directory first on
its agents' PATH; the app doesn't set PATH itself, because the server
rebuilds PATH from the login shell (review panel, second pass).

Nothing outside the J5 home is touched: no command on the person's PATH and
no shell startup file. An in-app command to install `j5` for the person's
own terminal is #441. The script says so when the app is gone.

Part of #397.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@Jacksondr5
Jacksondr5 force-pushed the j5/cli-desktop-command branch from 5249702 to 9783af8 Compare October 4, 2026 22:30
@Jacksondr5
Jacksondr5 merged commit 826785c into j5/main Oct 4, 2026
37 checks passed
@Jacksondr5
Jacksondr5 deleted the j5/cli-desktop-command branch October 4, 2026 22:52

This branch was successfully deployed

1 active deployment
Preview — 9783af89 Deployed Oct 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant