@staff0rd/assist 0.1058.1 → 0.1058.3

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.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.1058.1",
9
+ version: "0.1058.3",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -1492,6 +1492,9 @@ function projectConfigPathFrom(cwd) {
1492
1492
  return getConfigPathFrom(clone ?? cwd);
1493
1493
  }
1494
1494
  function loadConfigFrom(cwd, globalConfigPath = getGlobalConfigPath()) {
1495
+ return assistConfigSchema.parse(loadMergedRawConfig(cwd, globalConfigPath));
1496
+ }
1497
+ function loadMergedRawConfig(cwd, globalConfigPath = getGlobalConfigPath()) {
1495
1498
  const globalRaw = loadRawYaml(globalConfigPath);
1496
1499
  const projectRaw = loadRawYaml(projectConfigPathFrom(cwd));
1497
1500
  const userDb = readConfigCacheFile().user;
@@ -1504,7 +1507,7 @@ function loadConfigFrom(cwd, globalConfigPath = getGlobalConfigPath()) {
1504
1507
  mergeRawConfigs(globalWithRepo, projectRaw)
1505
1508
  );
1506
1509
  delete merged.repos;
1507
- return assistConfigSchema.parse(merged);
1510
+ return merged;
1508
1511
  }
1509
1512
 
1510
1513
  // src/shared/loadConfig.ts
@@ -11889,12 +11892,32 @@ async function revertDiffPaths(req, res) {
11889
11892
  }
11890
11893
 
11891
11894
  // src/commands/sessions/web/newSessionDefaults.ts
11895
+ var newSessionModeSchema = assistConfigSchema.shape.sessions.unwrap().shape.newSessionMode;
11896
+ function configuredMode(raw) {
11897
+ const sessions = raw.sessions;
11898
+ if (!sessions || typeof sessions !== "object") return void 0;
11899
+ return sessions.newSessionMode;
11900
+ }
11892
11901
  function newSessionDefaults(req, res) {
11893
11902
  const url = new URL(req.url ?? "/", "http://localhost");
11894
- const cwd = url.searchParams.get("cwd");
11895
- const config = cwd ? loadConfigFrom(cwd) : loadConfig();
11896
- const mode = config.sessions?.newSessionMode ?? "draft";
11897
- respondJson(res, 200, { mode });
11903
+ const cwd = url.searchParams.get("cwd") ?? process.cwd();
11904
+ let raw;
11905
+ try {
11906
+ raw = loadMergedRawConfig(cwd);
11907
+ } catch (error) {
11908
+ const message3 = error instanceof Error ? error.message : String(error);
11909
+ respondJson(res, 500, { error: `Couldn't read config: ${message3}` });
11910
+ return;
11911
+ }
11912
+ const parsed = newSessionModeSchema.safeParse(configuredMode(raw));
11913
+ if (!parsed.success) {
11914
+ const message3 = parsed.error.issues[0]?.message ?? "invalid value";
11915
+ respondJson(res, 422, {
11916
+ error: `Invalid config sessions.newSessionMode: ${message3}`
11917
+ });
11918
+ return;
11919
+ }
11920
+ respondJson(res, 200, { mode: parsed.data });
11898
11921
  }
11899
11922
 
11900
11923
  // src/commands/sessions/nodes/fetchPeerJson.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1058.1",
3
+ "version": "0.1058.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {