refactor(repo): restructure into apps/ + packages/ + native/ (atomic)#724
Conversation
Sorts the repo by kind (Turborepo/Nx apps+packages convention + a native/ bucket
for standalone daemons). One atomic move; no JS workspaces (nothing cross-imports,
so each package self-installs — avoids the @inquirer/core hoisting break).
apps/cli/ @phnx-labs/agents-cli (was repo root) + menubar/ (welded, in tarball)
apps/factory/ the Factory GUI (was packages/factory)
packages/ session-tracker, swarmify-mirror (shared libs)
native/computer-mac was packages/computer-helper (fixes mac/win naming asymmetry)
native/computer-win was packages/computer-helper-win
root now { "private": true } monorepo root + new README
Hand-edits: menubar resolver -> ../../../menubar; computer-* resolvers ->
../../../../native/computer-{mac,win} (depth +2, native/ at repo root while the CLI
is nested under apps/cli); CI working-directory: apps/cli on tests/tests-windows/
ci/bench + path filters re-prefixed in lockstep + computer-helper-win.yml ->
native/computer-win; release.sh git show <ref>:package.json -> :apps/cli/package.json.
VS Code publish identity (publisher swarmify / swarm-ext / appId) unchanged.
Verified: apps/cli frozen install + build rc=0.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts: # package.json
Code ReviewerVerdict: Changes requested Build: Green — AGENTS.md / CLAUDE.md read: What works wellThe core restructure is solid. All three runtime path fixes are correct:
CI workflows ( Issues that need attention1.
|
#728) * fix(sessions): stop co-located sessions from sharing one preview/topic `sessions --active` showed the IDENTICAL preview + topic for every session in one cwd — 6 editor tabs, or two worktree siblings, all looked like duplicate cards. Root cause: findClaudeSessionFile fell back to the newest `.jsonl` in the cwd whenever a session's `<id>.jsonl` wasn't found, so N distinct sessions collapsed onto ONE file (preview + topic derive solely from that file). The id goes stale because an editor caches the launch uuid in live-terminals.json, but Claude rotates its transcript uuid on resume/compact. - Extract `pickSessionFile(projectDir, id?)`: a concrete id returns its own file or undefined, NEVER a sibling's; the newest-file fallback is gated to the no-id case. - listTerminalsActive resolves each tab's EXACT id from the pid registry first (mirroring the headless path). - classifyActivity: no resolvable file now means `idle`, not `running`. - Test active.pickfile.test.ts (vitest, real temp files, no mocks). Verified end-to-end pre-restructure: 6 codium tabs went from 6x identical preview -> 6x distinct (blank, idle). Rebuilt on the apps/cli layout after #724. Supersedes #727 (which targeted the pre-restructure src/ path). * docs(sessions): correct pid-registry comment — no-op for editor shell pids Reviewer flagged the comment overstated the registry lookup: live-terminals.json stores the shell pid but the by-pid registry is keyed by the agent pid, so for editor-launched terminals the lookup returns undefined and falls back to the cached id. The duplicate-card fix is pickSessionFile no longer borrowing a sibling. Comment now says so; no behavior change.
The #724 restructure moved src/scripts/tests into apps/cli/ but left docs/ at the repo root. Colocate the CLI docs with the CLI. Doc-internal ../src links now resolve to apps/cli/src again.
…/cli/bin, repoint stale refs The restructure left the release broken: the signed keychain + menubar .app bundles live at repo-root bin/ (untracked, gitignored via /bin/), but every apps/cli script now looks in apps/cli/bin/. prepack (verify-*-helper.sh) fails → npm publish aborts; the build cp is swallowed by || true → JS-only tarball. - .gitignore: /bin/ -> /apps/cli/bin/ so staged signed bundles stay ignored (and don't dirty the release tree). Bundles get placed at apps/cli/bin/ at release time; sha already matches the pin, no rebuild/notarization. - Dockerfile.test: build + test from apps/cli (no root build script; src moved). - apps/cli/scripts/build-win.sh: native/ is a repo-root sibling of apps/, not under apps/cli — point PROJECT at ../../native/computer-win. - .gitleaks.toml: anchor allowlist paths at apps/cli/src/lib. - AGENTS.md / README.md / CONTRIBUTING.md: repoint src/docs/scripts links, build/release/install commands, and the menubar path at the apps/cli layout.
Replays the browser session-cookie changes onto the apps/cli/ layout (restructure #724 moved src/ -> apps/cli/src/) and rebases the CHANGELOG onto main's current Unreleased section.
What
Why no workspaces
The CLI imports nothing from sibling packages except the 3 native helpers (verified: 0 cross-imports of session-tracker/swarmify/factory). So each package self-installs exactly as before — which also means the
@inquirer/corehoisting break (caused by adding workspaces) cannot recur.Only hand-edits (everything else is
git mv)install-menubar.ts):../../../packages/menubar-helper→../../../menubar(moved with the CLI, same depth).computer-rpc.ts,ssh-tunnel.ts): depth +2 →../../../../native/computer-{mac,win}— becausenative/sits at the repo root while the CLI is now nested underapps/cli. (This was the one real trap; recomputed, not blind-replaced.)working-directory: apps/cliontests/tests-windows/ci/bench; path filters re-prefixed in lockstep (tests-windows+ its-noopcompanion);computer-helper-win.yml→native/computer-win.git show <ref>:package.json→:apps/cli/package.json(2 lines).VS Code publish identity unchanged (
publisher: swarmify,name: swarm-ext,appId: com.swarmify.factory).Verified (local, macOS)
cd apps/cli && bun install --frozen-lockfile && bun run build→ rc=0 (no@inquirer/corerecurrence).bun run test→ 4313 pass; the only 2 failures are pre-existing env-pollution insrc/lib/exec.test.ts(assertDISABLE_AUTOUPDATER/AGENTS_MAILBOX_DIRunset — both set in an agent session; green on clean CI).npm pack --dry-run→ 769 files, noapps/packages/nativeleak into the CLI tarball.apps/factoryextension host compiles (rc=0).native/computer-macbuilds; the built CLI'sagents computer statusresolves the helper from the new location (reports daemon/policy, not "helper not built").Not verifiable locally (release-machine step)
The full
release.sh <ver>dry-run previews the tarball viaprepack, which needs the notarized keychain.app(only on the release machine — same reason there's no CI publish). The build/test portions are verified above; the 2release.shpath edits are trivial and exercised at the next release.