refactor: one resolver for the app home directory (SUPER-2983)

Merged
SA
2d ago
+239-252

First of two PRs that retire ~/.superset (Linear SUPER-2983). No change for users: the home is still ~/.superset. This makes every process find it through one function, so the move in the next PR changes one place.

What changes

  • resolveAppHomeDir() in @superset/agent-setup/paths replaces resolveSupersetHomeDir() and the CLI's getSupersetHomeDir().
  • host-service: worktrees, sessions, attachments, agent jobs, the pty-daemon manifest and socket key, the usage pointers and the per-machine project override now use it. Worktrees and sessions used to ignore SUPERSET_HOME_DIR; they now follow it, so dev-workspace builds keep their worktrees under their own home. Existing worktrees keep their stored absolute paths.
  • desktop: call-time code uses the resolver. The terminal-host client and daemon compute paths at module load, so they read app-environment's SUPERSET_HOME_DIR, which is set before anything else loads. The two places that read the production home on purpose use defaultAppHomeDir().
  • Hook and plugin templates take the directory name from APP_HOME_DIR_NAME. Rendered output is byte-identical to main (checked for all seven templates), so installed hooks are not rewritten.
  • Tests that wrote user-override fixtures into the real ~/.superset/projects now use a temp home.

Verified

  • tsc clean for agent-setup, cli, host-service, trpc and desktop (desktop's only errors are the missing generated route tree, same as main).
  • Tests: agent-setup, cli, host-service, desktop src/main / src/lib / src/shared. The one local failure, AgentJobRunner > deletes finished jobs after a day, fails the same way on main.

Summary by cubic

First of two PRs that retire ~/.superset (Linear SUPER-2983). No change for users: every process now resolves the app home directory through one function, resolveAppHomeDir() in @superset/agent-setup/paths, so the move in the next PR changes one place.

  • resolveAppHomeDir() replaces resolveSupersetHomeDir() and the CLI's getSupersetHomeDir(); new helpers expose the default dir name and path.
  • Worktrees and sessions now honor SUPERSET_HOME_DIR; dev-workspace builds keep worktrees under their own home, while existing worktrees keep their stored absolute paths.
  • Desktop terminal-host paths are read from app-environment's SUPERSET_HOME_DIR; only code that intentionally reads the production home uses defaultAppHomeDir().
  • Hook and plugin templates take the directory name from APP_HOME_DIR_NAME, with rendered output byte-identical to before so installed hooks are not rewritten.
  • Tests that wrote fixtures into the real ~/.superset/projects now use a temp app home.

Verified: tsc clean across all touched packages, and the one failing test, AgentJobRunner > deletes finished jobs after a day, fails identically on main.

Summary by CodeRabbit

  • Improvements
    • App data, settings, worktrees, sessions, terminal history, and related files now use a consistent application home directory. Existing custom directory settings continue to take precedence.
    • Agent integrations and host services now use the application home directory consistently when locating configuration, plugins, hooks, and host files.
    • Project-specific configuration remains supported from the application home directory, while existing project lookup behavior is unchanged.