W1: guarded migration of every executable state-root site; uninstall deletes only ~/.gstack

Bins, careful/freeze hooks, setup, upgrade migrations, browse/src, design,
ios-qa daemon, lib and scripts resolve the state root through
bin/gstack-state-root.sh (bash) or lib/state-root.ts (TS). Bins source the
twin and stop with a reinstall message when it is missing; hooks source it
and never spawn gstack-paths. browse/src/config.ts and lib/cso/state.ts
delegate to resolveStateRoot. Analytics writers and readers move together
so the usage log stays one file. gstack-uninstall deletes state only at
~/.gstack, refuses (exit 2) when it resolves to /, $HOME or an ancestor,
the checkout or the git root, and leaves any other resolved root in place
with the removal command. Fixtures that copy single bins now copy the twin.
This commit is contained in:
garrytan committed 2026-09-30 06:38:50 +00:00
1 parent ab3b6f02e8
commit cd7485b0b4
98 files changed
+546 -268

No files matched your search

+2 -2
View File
@@ -12,11 +12,11 @@
*/
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
import { homedir } from "os";
import { dirname, join, resolve } from "path";
import { execFileSync } from "child_process";
import { hasRepoPolicyStore, repoPolicyTier } from "../gbrain-repo-policy-client";
import type { CodeProviderId, OpClass } from "./contract";
import { resolveStateRoot } from "../state-root";
export interface Selection {
provider: CodeProviderId | null;
@@ -31,7 +31,7 @@ export interface Selection {
const EMPTY: Selection = { provider: null, consents: {}, roots: {}, declined: false };
function storePath(env: NodeJS.ProcessEnv = process.env): string {
const home = env.GSTACK_HOME || join(env.HOME || homedir(), ".gstack");
const home = resolveStateRoot(env);
return join(home, "code-intelligence.json");
}