fix: inline preferences path to fix remote questions setup (#1110) (#1111)

`remote-questions-config.ts` was extracted in #592 to avoid crossing
the compiled/uncompiled boundary. However, it still imported
`getGlobalGSDPreferencesPath` from `preferences.ts` via a `.js`
extension — which fails at runtime because `preferences.ts` is
loaded via jiti and never compiled to `.js` in dist/.

This caused remote questions setup (Telegram/Slack/Discord) to fail
during `gsd config` with:

  Cannot find module '.../preferences.js' imported from
  .../remote-questions-config.js

Fix: inline the path constant directly. It's a single `join()` call
with no logic, so duplicating it is cleaner than adding a build step
or creating a separate compiled module just for this one export.
This commit is contained in:
Rytis Lukosevicius 2026-03-18 08:24:43 +01:00 committed by GitHub
parent 920f1bed9a
commit 33f04df029

View file

@ -9,11 +9,17 @@
*/
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
import { dirname } from "node:path";
import { getGlobalGSDPreferencesPath } from "./resources/extensions/gsd/preferences.js";
import { dirname, join } from "node:path";
import { homedir } from "node:os";
// Inlined from preferences.ts to avoid crossing the compiled/uncompiled
// boundary — this file is compiled by tsc, but preferences.ts is loaded
// via jiti at runtime. Importing it as .js fails because no .js exists
// in dist/. See #592, #1110.
const GLOBAL_PREFERENCES_PATH = join(homedir(), ".gsd", "preferences.md");
export function saveRemoteQuestionsConfig(channel: "slack" | "discord" | "telegram", channelId: string): void {
const prefsPath = getGlobalGSDPreferencesPath();
const prefsPath = GLOBAL_PREFERENCES_PATH;
const block = [
"remote_questions:",
` channel: ${channel}`,