fix(setup): ship supabase/config.sh with every host runtime root

Distinct from the lib/-beside-bin/ defect: gstack-telemetry-sync,
gstack-update-check, gstack-security-dashboard and
gstack-community-dashboard all source $GSTACK_DIR/supabase/config.sh to
resolve GSTACK_SUPABASE_URL, where GSTACK_DIR is the installed root
(parent of bin/). The [ -f ... ] guard means a root without the file
degrades SILENTLY — telemetry and update checks just stop resolving the
project URL on non-Claude installs. Closes #2215.

setup now links supabase/config.sh (file-level on purpose — migrations/
and functions/ are dev-only) via _link_or_copy at all five host-install
sites: the PR's four (Codex, Factory, OpenCode runtime roots + the Kiro
block) plus the .agents sidecar, whose bin/ resolves the same relative
path and which the PR predates covering.

The runtime-root test now asserts supabase/config.sh is present in
every built root, on both the symlink and Windows-copy branches.

Contributed by @jizusun (PR #2216).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-14 20:20:54 -07:00
co-authored by Claude Fable 5
parent b57c898dfb
commit d10aa39408
2 changed files with 36 additions and 1 deletions
+9 -1
View File
@@ -34,7 +34,7 @@ function extractFunction(name: string): string {
// a complete statement list.
function extractKiroBlock(): string {
const startAnchor = 'KIRO_GSTACK="$KIRO_SKILLS/gstack"';
const endAnchor = '_link_or_copy "$SOURCE_GSTACK_DIR/browse/bin" "$KIRO_GSTACK/browse/bin"';
const endAnchor = '_link_or_copy "$SOURCE_GSTACK_DIR/supabase/config.sh" "$KIRO_GSTACK/supabase/config.sh"\n fi';
const start = SETUP_SRC.indexOf(startAnchor);
const end = SETUP_SRC.indexOf(endAnchor, start);
if (start < 0 || end < 0) throw new Error('Could not locate the Kiro install block in setup');
@@ -48,6 +48,7 @@ interface CommandResult {
runStderr: string;
learningsWritten: boolean;
libIsSymlink: boolean | null;
supabaseConfigPresent: boolean;
}
// Build one host runtime root inside a sandbox using the real setup shell code
@@ -93,6 +94,11 @@ function buildRootAndRunCommand(
runStderr: run.stderr,
learningsWritten,
libIsSymlink: libLst ? libLst.isSymbolicLink() : null,
// Distinct defect (#2215): telemetry-class bin scripts source
// $GSTACK_DIR/supabase/config.sh to resolve GSTACK_SUPABASE_URL. The
// [ -f ... ] guard means a missing file degrades SILENTLY, so only a
// presence check on the installed root catches it.
supabaseConfigPresent: fs.existsSync(path.join(rootDir, 'supabase', 'config.sh')),
};
} finally {
fs.rmSync(sandbox, { recursive: true, force: true });
@@ -158,6 +164,7 @@ describe.skipIf(process.platform === 'win32')('setup: bin commands resolve sibli
expect(r.runStderr).not.toContain('lib/jsonl-store.ts');
expect(r.runStatus).toBe(0);
expect(r.learningsWritten).toBe(true);
expect(r.supabaseConfigPresent).toBe(true);
});
test(`${host} root (Windows copy install): gstack-learnings-log imports ../lib and writes the learning`, () => {
@@ -168,6 +175,7 @@ describe.skipIf(process.platform === 'win32')('setup: bin commands resolve sibli
expect(r.runStderr).not.toContain('lib/jsonl-store.ts');
expect(r.runStatus).toBe(0);
expect(r.learningsWritten).toBe(true);
expect(r.supabaseConfigPresent).toBe(true);
});
}