kimaki 0.8.0 → 0.8.1

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/cli.js CHANGED
@@ -746,7 +746,7 @@ async function resolveCredentials({ forceRestartOnboarding, forceGateway, gatewa
746
746
  const resp = await fetch(pollUrl.toString());
747
747
  if (resp.ok) {
748
748
  const data = (await resp.json());
749
- if (data.guild_id) {
749
+ if (data?.guild_id) {
750
750
  guildId = data.guild_id;
751
751
  installerDiscordUserId = data.discord_user_id;
752
752
  break;
@@ -821,7 +821,15 @@ async function startOAuthFlow(interaction, ctx, hash) {
821
821
  });
822
822
  return;
823
823
  }
824
- const { url, method, instructions } = (await authorizeRes.json());
824
+ const loginData = (await authorizeRes.json());
825
+ if (!loginData) {
826
+ await interaction.editReply({
827
+ content: 'Failed to parse authorization response',
828
+ components: [],
829
+ });
830
+ return;
831
+ }
832
+ const { url, method, instructions } = loginData;
825
833
  let message = `**Authenticating with ${ctx.providerName}**\n\n`;
826
834
  message += `Open this URL to authorize:\n${url}\n\n`;
827
835
  if (instructions) {
@@ -217,7 +217,7 @@ export async function evictExistingInstance({ port }) {
217
217
  if (probe instanceof Error)
218
218
  return;
219
219
  const body = await probe.json().catch((e) => new FetchError({ url, cause: e }));
220
- if (body instanceof Error)
220
+ if (body instanceof Error || !body)
221
221
  return;
222
222
  const targetPid = body.pid;
223
223
  if (!targetPid || targetPid === process.pid)
package/dist/upgrade.js CHANGED
@@ -73,7 +73,7 @@ export async function getLatestNpmVersion() {
73
73
  return null;
74
74
  }
75
75
  const data = (await res.json());
76
- return data.version;
76
+ return data?.version ?? null;
77
77
  }
78
78
  catch {
79
79
  return null;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "kimaki",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.8.0",
5
+ "version": "0.8.1",
6
6
  "repository": "https://github.com/remorses/kimaki",
7
7
  "bin": "bin.js",
8
8
  "files": [
@@ -25,8 +25,8 @@
25
25
  "prisma": "7.4.2",
26
26
  "tsx": "^4.20.5",
27
27
  "undici": "^8.0.2",
28
- "discord-digital-twin": "^0.1.0",
29
28
  "opencode-cached-provider": "^0.0.1",
29
+ "discord-digital-twin": "^0.1.0",
30
30
  "opencode-deterministic-provider": "^0.0.1",
31
31
  "db": "^0.0.0"
32
32
  },
@@ -64,10 +64,10 @@
64
64
  "yaml": "^2.8.3",
65
65
  "zod": "^4.3.6",
66
66
  "zustand": "^5.0.11",
67
- "libsqlproxy": "^0.1.0",
68
- "opencode-injection-guard": "^0.2.1",
69
67
  "errore": "^0.14.1",
70
- "traforo": "^0.5.0"
68
+ "libsqlproxy": "^0.1.0",
69
+ "traforo": "^0.5.0",
70
+ "opencode-injection-guard": "^0.2.1"
71
71
  },
72
72
  "optionalDependencies": {
73
73
  "@snazzah/davey": "^0.1.10",
package/src/cli.ts CHANGED
@@ -1131,8 +1131,8 @@ async function resolveCredentials({
1131
1131
  const data = (await resp.json()) as {
1132
1132
  guild_id?: string
1133
1133
  discord_user_id?: string
1134
- }
1135
- if (data.guild_id) {
1134
+ } | null
1135
+ if (data?.guild_id) {
1136
1136
  guildId = data.guild_id
1137
1137
  installerDiscordUserId = data.discord_user_id
1138
1138
  break
@@ -1097,11 +1097,19 @@ async function startOAuthFlow(
1097
1097
  return
1098
1098
  }
1099
1099
 
1100
- const { url, method, instructions } = (await authorizeRes.json()) as {
1100
+ const loginData = (await authorizeRes.json()) as {
1101
1101
  url: string
1102
1102
  method: 'auto' | 'code'
1103
1103
  instructions: string
1104
+ } | null
1105
+ if (!loginData) {
1106
+ await interaction.editReply({
1107
+ content: 'Failed to parse authorization response',
1108
+ components: [],
1109
+ })
1110
+ return
1104
1111
  }
1112
+ const { url, method, instructions } = loginData
1105
1113
 
1106
1114
  let message = `**Authenticating with ${ctx.providerName}**\n\n`
1107
1115
  message += `Open this URL to authorize:\n${url}\n\n`
@@ -260,7 +260,7 @@ export async function evictExistingInstance({ port }: { port: number }) {
260
260
  const body = await (probe.json() as Promise<{ pid?: number }>).catch(
261
261
  (e) => new FetchError({ url, cause: e }),
262
262
  )
263
- if (body instanceof Error) return
263
+ if (body instanceof Error || !body) return
264
264
 
265
265
  const targetPid = body.pid
266
266
  if (!targetPid || targetPid === process.pid) return
package/src/upgrade.ts CHANGED
@@ -82,8 +82,8 @@ export async function getLatestNpmVersion(): Promise<string | null> {
82
82
  if (!res.ok) {
83
83
  return null
84
84
  }
85
- const data = (await res.json()) as { version: string }
86
- return data.version
85
+ const data = (await res.json()) as { version: string } | null
86
+ return data?.version ?? null
87
87
  } catch {
88
88
  return null
89
89
  }