@keystrokehq/cli 0.0.141 → 0.0.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as QueuedRunResponseSchema, A as ListOrganizationInvitationsResponseSchema, B as PollRunResponseSchema, C as HealthResponseSchema, Ct as listenPortFromPublicUrl, D as HistoryRunListResponseSchema, E as HistoryRunListQuerySchema, Et as parseErrorResponse, F as ListProjectMetricsResponseSchema, G as PresignUserAvatarRequestSchema, H as PresignOrgLogoResponseSchema, I as ListProjectsResponseSchema, J as ProjectResponseSchema, K as PresignUserAvatarResponseSchema, L as OrganizationSidebarBrandingPatchSchema, M as ListOrganizationsResponseSchema, N as ListProjectDeploymentsResponseSchema, O as InviteOrganizationMembersRequestSchema, P as ListProjectFilesResponseSchema, Q as QueuedAgentPromptResponseSchema, R as OrganizationSidebarBrandingSchema, S as GatewayAttachmentRecordSchema, St as WorkflowSummaryListResponseSchema, T as HistoryRunDetailResponseSchema, Tt as originFromPublicUrl, U as PresignProjectSourceRequestSchema, V as PresignOrgLogoRequestSchema, W as PresignProjectSourceResponseSchema, X as PromptInputSchema, Y as ProjectSlugAvailabilityResponseSchema, Z as PromptResponseSchema, _ as CreateProjectResponseSchema, _t as UserAvatarPatchSchema, a as AgentSessionDetailResponseSchema, at as TriggerDetailResponseSchema, b as DeclineOrganizationInvitationResponseSchema, bt as WorkflowRunListResponseSchema, c as AgentSummaryListResponseSchema, ct as TriggerRunListResponseSchema, d as ConnectProvidersResponseSchema, dt as UpdateOrganizationMemberResponseSchema, et as ROUTE_MANIFEST_REL_PATH, f as CreateCredentialInstanceBodySchema, ft as UpdateOrganizationRequestSchema, g as CreateProjectRequestSchema, gt as UpsertGatewayAttachmentBodySchema, h as CreateProjectArtifactResponseSchema, ht as UploadProjectSourceResponseSchema, i as AgentListResponseSchema, it as SlugAvailabilityResponseSchema, j as ListOrganizationMembersResponseSchema, k as InviteOrganizationMembersResponseSchema, l as CompleteProjectArtifactResponseSchema, lt as UpdateCredentialInstanceBodySchema, m as CreateOrganizationResponseSchema, mt as UploadProjectSourceManifestRequestSchema, n as AcceptOrganizationInvitationResponseSchema, nt as SkillSummaryDetailResponseSchema, o as AgentSessionListResponseSchema, ot as TriggerListResponseSchema, p as CreateOrganizationRequestSchema, pt as UpdateProjectRequestSchema, q as ProjectReachabilityResponseSchema, r as ActiveOrganizationResponseSchema, rt as SkillSummaryListResponseSchema, s as AgentSummaryDetailResponseSchema, st as TriggerRunDetailResponseSchema, t as ACTIVE_ORG_HEADER, tt as RecentResourceListResponseSchema, u as ConnectAuthorizeUrlResponseSchema, ut as UpdateOrganizationMemberRequestSchema, v as CredentialInstanceListResponseSchema, vt as UserAvatarSchema, w as HistoryRunCancelResponseSchema, x as ErrorResponseSchema, xt as WorkflowSummaryDetailResponseSchema, y as CredentialInstanceRecordSchema, yt as WorkflowRunDetailResponseSchema, z as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS } from "./dist-B27Z3YpE.mjs";
2
+ import { $ as QueuedRunResponseSchema, A as ListOrganizationInvitationsResponseSchema, B as PollRunResponseSchema, C as HealthResponseSchema, Ct as WorkflowSummaryDetailResponseSchema, D as HistoryRunListResponseSchema, Dt as originFromPublicUrl, E as HistoryRunListQuerySchema, F as ListProjectMetricsResponseSchema, G as PresignUserAvatarRequestSchema, H as PresignOrgLogoResponseSchema, I as ListProjectsResponseSchema, J as ProjectResponseSchema, K as PresignUserAvatarResponseSchema, L as OrganizationSidebarBrandingPatchSchema, M as ListOrganizationsResponseSchema, N as ListProjectDeploymentsResponseSchema, O as InviteOrganizationMembersRequestSchema, Ot as parseErrorResponse, P as ListProjectFilesResponseSchema, Q as QueuedAgentPromptResponseSchema, R as OrganizationSidebarBrandingSchema, S as GatewayAttachmentRecordSchema, St as WorkflowRunListResponseSchema, T as HistoryRunDetailResponseSchema, Tt as listenPortFromPublicUrl, U as PresignProjectSourceRequestSchema, V as PresignOrgLogoRequestSchema, W as PresignProjectSourceResponseSchema, X as PromptInputSchema, Y as ProjectSlugAvailabilityResponseSchema, Z as PromptResponseSchema, _ as CreateProjectResponseSchema, _t as UserAvatarPatchSchema, a as AgentSessionDetailResponseSchema, at as TriggerDetailResponseSchema, b as DeclineOrganizationInvitationResponseSchema, bt as UserPreferencesSchema, c as AgentSummaryListResponseSchema, ct as TriggerRunListResponseSchema, d as ConnectProvidersResponseSchema, dt as UpdateOrganizationMemberResponseSchema, et as ROUTE_MANIFEST_REL_PATH, f as CreateCredentialInstanceBodySchema, ft as UpdateOrganizationRequestSchema, g as CreateProjectRequestSchema, gt as UpsertGatewayAttachmentBodySchema, h as CreateProjectArtifactResponseSchema, ht as UploadProjectSourceResponseSchema, i as AgentListResponseSchema, it as SlugAvailabilityResponseSchema, j as ListOrganizationMembersResponseSchema, k as InviteOrganizationMembersResponseSchema, l as CompleteProjectArtifactResponseSchema, lt as UpdateCredentialInstanceBodySchema, m as CreateOrganizationResponseSchema, mt as UploadProjectSourceManifestRequestSchema, n as AcceptOrganizationInvitationResponseSchema, nt as SkillSummaryDetailResponseSchema, o as AgentSessionListResponseSchema, ot as TriggerListResponseSchema, p as CreateOrganizationRequestSchema, pt as UpdateProjectRequestSchema, q as ProjectReachabilityResponseSchema, r as ActiveOrganizationResponseSchema, rt as SkillSummaryListResponseSchema, s as AgentSummaryDetailResponseSchema, st as TriggerRunDetailResponseSchema, t as ACTIVE_ORG_HEADER, tt as RecentResourceListResponseSchema, u as ConnectAuthorizeUrlResponseSchema, ut as UpdateOrganizationMemberRequestSchema, v as CredentialInstanceListResponseSchema, vt as UserAvatarSchema, w as HistoryRunCancelResponseSchema, wt as WorkflowSummaryListResponseSchema, x as ErrorResponseSchema, xt as WorkflowRunDetailResponseSchema, y as CredentialInstanceRecordSchema, yt as UserPreferencesPatchSchema, z as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS } from "./dist-B3JNNLsy.mjs";
3
3
  import { t as walkProject } from "./walk-project-171B4cvO-DJy3qZKd.mjs";
4
4
  import { a as installPlaygroundDependencies, i as installDependencies, n as buildPlaygroundWorkspace, o as resolvePackageManager, s as resolveCliRoot, t as readCliVersion } from "./version-DESgLEkE.mjs";
5
5
  import { createRequire } from "node:module";
@@ -3784,8 +3784,8 @@ const DEFAULT_PROJECT_SETTINGS = {
3784
3784
  defaultRole: "editor",
3785
3785
  invitePermission: "admin"
3786
3786
  };
3787
- const MOCK_STORAGE_KEY$2 = "keystroke:mock-project-settings:v1";
3788
- function getBrowserLocalStorage$2() {
3787
+ const MOCK_STORAGE_KEY$1 = "keystroke:mock-project-settings:v1";
3788
+ function getBrowserLocalStorage$1() {
3789
3789
  if (typeof globalThis !== "object") return null;
3790
3790
  return globalThis.localStorage ?? null;
3791
3791
  }
@@ -3811,10 +3811,10 @@ function mergeProjectSettings(current, patch) {
3811
3811
  });
3812
3812
  }
3813
3813
  function readSettingsStore() {
3814
- const localStorage = getBrowserLocalStorage$2();
3814
+ const localStorage = getBrowserLocalStorage$1();
3815
3815
  if (!localStorage) return {};
3816
3816
  try {
3817
- const raw = localStorage.getItem(MOCK_STORAGE_KEY$2);
3817
+ const raw = localStorage.getItem(MOCK_STORAGE_KEY$1);
3818
3818
  if (!raw) return {};
3819
3819
  const parsed = JSON.parse(raw);
3820
3820
  if (!parsed || typeof parsed !== "object") return {};
@@ -3824,10 +3824,10 @@ function readSettingsStore() {
3824
3824
  }
3825
3825
  }
3826
3826
  function writeSettingsStore(store) {
3827
- const localStorage = getBrowserLocalStorage$2();
3827
+ const localStorage = getBrowserLocalStorage$1();
3828
3828
  if (!localStorage) return;
3829
3829
  try {
3830
- localStorage.setItem(MOCK_STORAGE_KEY$2, JSON.stringify(store));
3830
+ localStorage.setItem(MOCK_STORAGE_KEY$1, JSON.stringify(store));
3831
3831
  } catch {}
3832
3832
  }
3833
3833
  function requireProjectId(projectId) {
@@ -5650,176 +5650,38 @@ function createOrganizationSidebarBrandingResource(http, options = {}) {
5650
5650
  }
5651
5651
  };
5652
5652
  }
5653
- const MOCK_STORAGE_KEY$1 = "keystroke:mock-user-preferences:v1";
5654
- function getBrowserLocalStorage$1() {
5655
- if (typeof globalThis !== "object") return null;
5656
- return globalThis.localStorage ?? null;
5657
- }
5658
- const DEFAULT_USER_SIDEBAR_PREFERENCES = {
5659
- navIconVisibility: "visible",
5660
- footerChatRowVisibility: "visible",
5661
- hiddenNavItemIds: ["registry"],
5662
- topNavItemOrderIds: [],
5663
- workspaceNavItemOrderIds: []
5664
- };
5665
- const DEFAULT_USER_PREFERENCES = {
5666
- interfaceTheme: "system",
5667
- surfaceContrast: "on",
5668
- layoutMode: "linear",
5669
- fontSize: "default",
5670
- sidebar: DEFAULT_USER_SIDEBAR_PREFERENCES,
5671
- favorites: [],
5672
- projectOrderIds: [],
5673
- projectDotColors: {},
5674
- onboardingTabVisible: true
5675
- };
5676
- function normalizeInterfaceTheme(value) {
5677
- if (value === "light" || value === "dark") return value;
5678
- return "system";
5679
- }
5680
- function normalizeSurfaceContrast(value) {
5681
- return value === "off" ? "off" : "on";
5682
- }
5683
- function normalizeLayoutMode(value) {
5684
- return value === "default" ? "default" : "linear";
5685
- }
5686
- function normalizeFontSize(value) {
5687
- return value === "large" ? "large" : "default";
5688
- }
5689
- function normalizeStringList(value) {
5690
- if (!Array.isArray(value)) return [];
5691
- return Array.from(new Set(value.filter((item) => typeof item === "string")));
5692
- }
5693
- function normalizeHiddenNavItemIds(value) {
5694
- if (!Array.isArray(value)) return DEFAULT_USER_SIDEBAR_PREFERENCES.hiddenNavItemIds;
5695
- return normalizeStringList(value);
5696
- }
5697
- function normalizeSidebarPreferences(value) {
5698
- if (!value || typeof value !== "object") return DEFAULT_USER_SIDEBAR_PREFERENCES;
5699
- const sidebar = value;
5700
- return {
5701
- navIconVisibility: sidebar.navIconVisibility === "visible" ? "visible" : "hidden",
5702
- footerChatRowVisibility: sidebar.footerChatRowVisibility === "hidden" ? "hidden" : "visible",
5703
- hiddenNavItemIds: normalizeHiddenNavItemIds(sidebar.hiddenNavItemIds),
5704
- topNavItemOrderIds: normalizeStringList(sidebar.topNavItemOrderIds),
5705
- workspaceNavItemOrderIds: normalizeStringList(sidebar.workspaceNavItemOrderIds)
5706
- };
5707
- }
5708
- function isWorkspaceFavoriteKind(value) {
5709
- return value === "agent" || value === "workflow" || value === "skill";
5710
- }
5711
- function normalizeFavorites(value) {
5712
- if (!Array.isArray(value)) return [];
5713
- const seenKeys = /* @__PURE__ */ new Set();
5714
- const favorites = [];
5715
- for (const item of value) {
5716
- if (!item || typeof item !== "object") continue;
5717
- const favorite = item;
5718
- if (typeof favorite.kind !== "string" || !isWorkspaceFavoriteKind(favorite.kind) || typeof favorite.resourceId !== "string" || favorite.resourceId.length === 0) continue;
5719
- const key = `${favorite.kind}:${favorite.resourceId}`;
5720
- if (seenKeys.has(key)) continue;
5721
- seenKeys.add(key);
5722
- favorites.push({
5723
- kind: favorite.kind,
5724
- resourceId: favorite.resourceId
5725
- });
5726
- }
5727
- return favorites;
5728
- }
5729
- function normalizeProjectDotColors(value) {
5730
- if (!value || typeof value !== "object" || Array.isArray(value)) return {};
5731
- return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[0] === "string" && typeof entry[1] === "string"));
5732
- }
5733
- function normalizeOnboardingTabVisible(value) {
5734
- return typeof value === "boolean" ? value : DEFAULT_USER_PREFERENCES.onboardingTabVisible;
5735
- }
5736
- function normalizeUserPreferences(value) {
5737
- if (!value || typeof value !== "object") return DEFAULT_USER_PREFERENCES;
5738
- const preferences = value;
5739
- return {
5740
- interfaceTheme: normalizeInterfaceTheme(preferences.interfaceTheme),
5741
- surfaceContrast: normalizeSurfaceContrast(preferences.surfaceContrast),
5742
- layoutMode: normalizeLayoutMode(preferences.layoutMode),
5743
- fontSize: normalizeFontSize(preferences.fontSize),
5744
- sidebar: normalizeSidebarPreferences(preferences.sidebar),
5745
- favorites: normalizeFavorites(preferences.favorites),
5746
- projectOrderIds: normalizeStringList(preferences.projectOrderIds),
5747
- projectDotColors: normalizeProjectDotColors(preferences.projectDotColors),
5748
- onboardingTabVisible: normalizeOnboardingTabVisible(preferences.onboardingTabVisible)
5749
- };
5750
- }
5751
- function mergeUserPreferences(current, patch) {
5752
- return normalizeUserPreferences({
5753
- ...current,
5754
- ...patch,
5755
- sidebar: patch.sidebar ? {
5756
- ...current.sidebar,
5757
- ...patch.sidebar
5758
- } : current.sidebar
5759
- });
5760
- }
5761
- function readPreferencesStore() {
5762
- const localStorage = getBrowserLocalStorage$1();
5763
- if (!localStorage) return {};
5764
- try {
5765
- const raw = localStorage.getItem(MOCK_STORAGE_KEY$1);
5766
- if (!raw) return {};
5767
- const parsed = JSON.parse(raw);
5768
- if (!parsed || typeof parsed !== "object") return {};
5769
- const entries = Object.entries(parsed);
5770
- return Object.fromEntries(entries.map(([userId, value]) => [userId, normalizeUserPreferences(value)]));
5771
- } catch {
5772
- return {};
5773
- }
5774
- }
5775
- function writePreferencesStore(store) {
5776
- const localStorage = getBrowserLocalStorage$1();
5777
- if (!localStorage) return;
5778
- try {
5779
- localStorage.setItem(MOCK_STORAGE_KEY$1, JSON.stringify(store));
5780
- } catch {}
5781
- }
5782
- function resolveUserId(getCurrentUserId) {
5783
- const userId = getCurrentUserId()?.trim();
5784
- if (!userId) throw new Error("User preferences require an authenticated user");
5785
- return userId;
5786
- }
5787
- function createUserPreferencesResource(options) {
5653
+ const USER_PREFERENCES_PATH = "/api/users/me/preferences";
5654
+ function createUserPreferencesResource(http) {
5788
5655
  return {
5789
- get: mock({
5790
- domain: "userPreferences",
5791
- method: "get",
5792
- plannedEndpoint: "GET /api/account/preferences"
5793
- }, async () => {
5794
- const userId = resolveUserId(options.getCurrentUserId ?? (() => null));
5795
- return readPreferencesStore()[userId] ?? DEFAULT_USER_PREFERENCES;
5796
- }),
5797
- update: mock({
5798
- domain: "userPreferences",
5799
- method: "update",
5800
- plannedEndpoint: "PATCH /api/account/preferences"
5801
- }, async (patch) => {
5802
- const userId = resolveUserId(options.getCurrentUserId ?? (() => null));
5803
- const store = readPreferencesStore();
5804
- const next = mergeUserPreferences(store[userId] ?? DEFAULT_USER_PREFERENCES, patch);
5805
- writePreferencesStore({
5806
- ...store,
5807
- [userId]: next
5808
- });
5809
- return next;
5810
- })
5656
+ async get() {
5657
+ try {
5658
+ const data = await http.get(USER_PREFERENCES_PATH).json();
5659
+ return UserPreferencesSchema.parse(data);
5660
+ } catch (error) {
5661
+ throw await toPlatformError(error);
5662
+ }
5663
+ },
5664
+ async update(patch) {
5665
+ const body = UserPreferencesPatchSchema.parse(patch);
5666
+ try {
5667
+ const data = await http.patch(USER_PREFERENCES_PATH, { json: body }).json();
5668
+ return UserPreferencesSchema.parse(data);
5669
+ } catch (error) {
5670
+ throw await toPlatformError(error);
5671
+ }
5672
+ }
5811
5673
  };
5812
5674
  }
5813
5675
  function createUserAvatarResource(http) {
5814
5676
  async function presignUpload(contentType) {
5815
5677
  const body = PresignUserAvatarRequestSchema.parse({ contentType });
5816
- const data = await http.post("/api/avatar/presign", { json: body }).json();
5678
+ const data = await http.post("/api/users/me/avatar/presign", { json: body }).json();
5817
5679
  return PresignUserAvatarResponseSchema.parse(data);
5818
5680
  }
5819
5681
  return {
5820
5682
  async get() {
5821
5683
  try {
5822
- const data = await http.get("/api/avatar").json();
5684
+ const data = await http.get("/api/users/me/avatar").json();
5823
5685
  return UserAvatarSchema.parse(data);
5824
5686
  } catch (error) {
5825
5687
  throw await toPlatformError(error);
@@ -5840,7 +5702,7 @@ function createUserAvatarResource(http) {
5840
5702
  async update(patch) {
5841
5703
  const body = UserAvatarPatchSchema.parse(patch);
5842
5704
  try {
5843
- const data = await http.patch("/api/avatar", { json: body }).json();
5705
+ const data = await http.patch("/api/users/me/avatar", { json: body }).json();
5844
5706
  return UserAvatarSchema.parse(data);
5845
5707
  } catch (error) {
5846
5708
  throw await toPlatformError(error);
@@ -6457,7 +6319,7 @@ function createPlatformClient(options) {
6457
6319
  invitations: createInvitationsResource(http),
6458
6320
  apiKeys: createApiKeysResource(),
6459
6321
  recents: createRecentsResource(http),
6460
- userPreferences: createUserPreferencesResource({ getCurrentUserId: options.getCurrentUserId }),
6322
+ userPreferences: createUserPreferencesResource(http),
6461
6323
  userAvatar: createUserAvatarResource(http),
6462
6324
  organizationSidebarBranding: createOrganizationSidebarBrandingResource(http, { getActiveOrganizationId: () => activeOrganizationId }),
6463
6325
  getActiveOrganizationId: () => activeOrganizationId,
@@ -7270,7 +7132,7 @@ function registerBuildCommand(program) {
7270
7132
  program.command("build").description("Build the keystroke project for production").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
7271
7133
  try {
7272
7134
  const root = resolveProjectRoot(options.dir);
7273
- const { buildApp } = await import("./dist-CSolAKQe.mjs");
7135
+ const { buildApp } = await import("./dist-BRv4QMNA.mjs");
7274
7136
  await buildApp({ root });
7275
7137
  process.stdout.write(`Built ${root}\n`);
7276
7138
  } catch (error) {
@@ -7367,7 +7229,7 @@ async function runDeploy(options) {
7367
7229
  const client = createCliPlatformClient(config);
7368
7230
  let source;
7369
7231
  if (!options.skipBuild) {
7370
- const { buildApp } = await import("./dist-CSolAKQe.mjs");
7232
+ const { buildApp } = await import("./dist-BRv4QMNA.mjs");
7371
7233
  source = { files: (await buildApp({
7372
7234
  root,
7373
7235
  collectSources: true,
@@ -7467,7 +7329,7 @@ function runtimeChildEnv(parentEnv, overrides) {
7467
7329
  //#region src/project/bootstrap-run.ts
7468
7330
  /** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
7469
7331
  async function resolveBootstrapRun(options) {
7470
- const { resolveRuntimeBuildArtifact } = await import("./dist-CSolAKQe.mjs");
7332
+ const { resolveRuntimeBuildArtifact } = await import("./dist-BRv4QMNA.mjs");
7471
7333
  const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
7472
7334
  const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/bootstrap.mjs");
7473
7335
  const args = [`--import=${loader}`];
@@ -7617,7 +7479,7 @@ async function runDev(options) {
7617
7479
  process.on("SIGINT", shutdown);
7618
7480
  process.on("SIGTERM", shutdown);
7619
7481
  try {
7620
- const { watchApp } = await import("./dist-CSolAKQe.mjs");
7482
+ const { watchApp } = await import("./dist-BRv4QMNA.mjs");
7621
7483
  await watchApp({
7622
7484
  root,
7623
7485
  clean: false,
@@ -8232,7 +8094,7 @@ async function runStart(options) {
8232
8094
  const apiPort = Number(new URL(serverUrl).port || 80);
8233
8095
  const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
8234
8096
  ensureNativeDeps(runtimeNodeModules);
8235
- const { buildApp } = await import("./dist-CSolAKQe.mjs");
8097
+ const { buildApp } = await import("./dist-BRv4QMNA.mjs");
8236
8098
  await buildApp({
8237
8099
  root,
8238
8100
  clean: false
@@ -8401,9 +8263,56 @@ async function runConfigUseProject(config, projectRef) {
8401
8263
  };
8402
8264
  }
8403
8265
  //#endregion
8266
+ //#region src/commands/config/preferences-patch.ts
8267
+ function parsePreferenceValue(rawValue) {
8268
+ try {
8269
+ return JSON.parse(rawValue);
8270
+ } catch {
8271
+ return rawValue;
8272
+ }
8273
+ }
8274
+ function buildPreferencesPatchFromKeyValue(key, rawValue) {
8275
+ const trimmedKey = key.trim();
8276
+ if (!trimmedKey) throw new Error("Preference key is required");
8277
+ const value = parsePreferenceValue(rawValue);
8278
+ const segments = trimmedKey.split(".").filter(Boolean);
8279
+ if (segments.length === 0) throw new Error("Preference key is required");
8280
+ let patch = { [segments.at(-1)]: value };
8281
+ for (let index = segments.length - 2; index >= 0; index -= 1) patch = { [segments[index]]: patch };
8282
+ const parsed = UserPreferencesPatchSchema.safeParse(patch);
8283
+ if (!parsed.success) {
8284
+ const message = parsed.error.issues[0]?.message ?? "invalid value";
8285
+ throw new Error(`Invalid preference ${trimmedKey}: ${message}`);
8286
+ }
8287
+ return parsed.data;
8288
+ }
8289
+ //#endregion
8290
+ //#region src/commands/config/preferences.ts
8291
+ async function runConfigPreferencesGet(platform) {
8292
+ const preferences = await platform.userPreferences.get();
8293
+ return `${JSON.stringify(preferences, null, 2)}\n`;
8294
+ }
8295
+ async function runConfigPreferencesSet(platform, key, value) {
8296
+ const patch = buildPreferencesPatchFromKeyValue(key, value);
8297
+ const preferences = await platform.userPreferences.update(patch);
8298
+ return `${JSON.stringify(preferences, null, 2)}\n`;
8299
+ }
8300
+ function registerConfigPreferencesCommand(config) {
8301
+ const preferences = config.command("preferences").description("Manage user preferences");
8302
+ preferences.command("get").description("Show current user preferences as JSON").action(async () => {
8303
+ const platform = createCliPlatformClient(createCliConfig());
8304
+ process.stdout.write(await runConfigPreferencesGet(platform));
8305
+ });
8306
+ preferences.command("set").description("Update a user preference by dot-path key").argument("<key>", "Preference key, e.g. interfaceTheme or sidebar.navIconVisibility").argument("<value>", "Preference value (JSON or plain string)").action(async (key, value) => {
8307
+ const platform = createCliPlatformClient(createCliConfig());
8308
+ process.stdout.write(await runConfigPreferencesSet(platform, key, value));
8309
+ });
8310
+ }
8311
+ //#endregion
8404
8312
  //#region src/commands/config/index.ts
8405
8313
  function registerConfigCommand(program) {
8406
8314
  const config = program.command("config").description("Manage CLI configuration");
8315
+ registerConfigPreferencesCommand(config);
8407
8316
  config.command("show").description("Show CLI configuration").action(() => {
8408
8317
  const cliConfig = createCliConfig();
8409
8318
  const configDir = getConfigDir(cliConfig);