@devries-cameron20 / t3code-1 / commits / 31aa32b83b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Extract keybindings contracts into dedicated module

- add `packages/contracts/src/keybindings.ts` with keybinding schemas and types - import keybindings config schema from `server.ts` - re-export keybindings contracts from `packages/contracts/src/index.ts`

Julius Marminge committed Feb 15, 2026 at 11:24 UTC 31aa32b83bb234ef7f2bdad6a898d06ea1d0552e
3 files changed +24 -20
packages/contracts/src/index.ts
+1
@@ -5,6 +5,7 @@ export * from "./terminal";
5 export * from "./provider";
6 export * from "./model";
7 export * from "./ws";
8 +export * from "./keybindings";
9 export * from "./server";
10 export * from "./project";
11 export * from "./git";
packages/contracts/src/keybindings.ts new
+22
@@ -0,0 +1,22 @@
1 +import { z } from "zod";
2 +
3 +export const keybindingCommandSchema = z.enum([
4 + "terminal.toggle",
5 + "terminal.split",
6 + "terminal.new",
7 +]);
8 +
9 +const keybindingValueSchema = z.string().trim().min(1).max(64);
10 +const keybindingWhenSchema = z.string().trim().min(1).max(256);
11 +
12 +export const keybindingRuleSchema = z.object({
13 + key: keybindingValueSchema,
14 + command: keybindingCommandSchema,
15 + when: keybindingWhenSchema.optional(),
16 +});
17 +
18 +export const keybindingsConfigSchema = z.array(keybindingRuleSchema).max(256);
19 +
20 +export type KeybindingCommand = z.infer<typeof keybindingCommandSchema>;
21 +export type KeybindingRule = z.infer<typeof keybindingRuleSchema>;
22 +export type KeybindingsConfig = z.infer<typeof keybindingsConfigSchema>;
packages/contracts/src/server.ts
+1 -20
@@ -1,28 +1,9 @@
1 import { z } from "zod";
2 -
3 -export const keybindingCommandSchema = z.enum([
4 - "terminal.toggle",
5 - "terminal.split",
6 - "terminal.new",
7 -]);
8 -
9 -const keybindingValueSchema = z.string().trim().min(1).max(64);
10 -const keybindingWhenSchema = z.string().trim().min(1).max(256);
11 -
12 -export const keybindingRuleSchema = z.object({
13 - key: keybindingValueSchema,
14 - command: keybindingCommandSchema,
15 - when: keybindingWhenSchema.optional(),
16 -});
17 -
18 -export const keybindingsConfigSchema = z.array(keybindingRuleSchema).max(256);
2 +import { keybindingsConfigSchema } from "./keybindings";
3
4 export const serverConfigSchema = z.object({
5 cwd: z.string().min(1),
6 keybindings: keybindingsConfigSchema.default([]),
7 });
8
25 -export type KeybindingCommand = z.infer<typeof keybindingCommandSchema>;
26 -export type KeybindingRule = z.infer<typeof keybindingRuleSchema>;
27 -export type KeybindingsConfig = z.infer<typeof keybindingsConfigSchema>;
9 export type ServerConfig = z.infer<typeof serverConfigSchema>;