Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b416bef800 | ||
|
|
c3097ba5d7 | ||
|
|
32f1d4c34f | ||
|
|
80475e854c | ||
|
|
aeaf31ff6d | ||
|
|
8b9cf23ec7 | ||
|
|
68ff6d8578 | ||
|
|
8f5078c6d5 | ||
|
|
48fc85e7fe |
No files matched your search
@@ -15,6 +15,29 @@ The file must be a JSON array of rules:
|
||||
|
||||
See the full schema for more details: [`packages/contracts/src/keybindings.ts`](packages/contracts/src/keybindings.ts)
|
||||
|
||||
## Editor Schema Support
|
||||
|
||||
`keybindings.json` is intentionally a top-level JSON array, so it cannot carry an inline `$schema` property the way `settings.json` can.
|
||||
|
||||
To get autocomplete and hover docs in editors like VS Code, associate the file externally with the published schema:
|
||||
|
||||
```json
|
||||
{
|
||||
"json.schemas": [
|
||||
{
|
||||
"fileMatch": ["**/.t3/keybindings.json", "**/keybindings.json"],
|
||||
"url": "https://t3.codes/schemas/keybindings.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
If you want a pinned schema instead of the latest stable one, use a versioned URL such as:
|
||||
|
||||
```text
|
||||
https://t3.codes/schemas/keybindings/0.0.15.json
|
||||
```
|
||||
|
||||
## Defaults
|
||||
|
||||
```json
|
||||
|
||||
+13
-7
@@ -1,13 +1,14 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "T3 Code Keybindings",
|
||||
"description": "JSON Schema for the keybindings.json file consumed by T3 Code.",
|
||||
"description": "Ordered list of custom keybinding rules persisted in `keybindings.json`.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Keyboard shortcut to listen for."
|
||||
},
|
||||
"command": {
|
||||
"anyOf": [
|
||||
@@ -37,9 +38,11 @@
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^script\\.[\\s\\S]*?\\.run$"
|
||||
"pattern": "^script\\.[\\s\\S]*?\\.run$",
|
||||
"description": "Command identifier for running a project script, formatted as `script.<id>.run`."
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Command to execute when the shortcut matches."
|
||||
},
|
||||
"when": {
|
||||
"anyOf": [
|
||||
@@ -49,15 +52,18 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Optional expression limiting when the shortcut is active."
|
||||
}
|
||||
},
|
||||
"required": ["key", "command"],
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Single keybinding rule entry in `keybindings.json`."
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"maxItems": 256
|
||||
"maxItems": 256,
|
||||
"description": "Ordered list of custom keybinding rules persisted in `keybindings.json`."
|
||||
}
|
||||
]
|
||||
}
|
||||
+13
-7
@@ -1,13 +1,14 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "T3 Code Keybindings",
|
||||
"description": "JSON Schema for the keybindings.json file consumed by T3 Code.",
|
||||
"description": "Ordered list of custom keybinding rules persisted in `keybindings.json`.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Keyboard shortcut to listen for."
|
||||
},
|
||||
"command": {
|
||||
"anyOf": [
|
||||
@@ -37,9 +38,11 @@
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^script\\.[\\s\\S]*?\\.run$"
|
||||
"pattern": "^script\\.[\\s\\S]*?\\.run$",
|
||||
"description": "Command identifier for running a project script, formatted as `script.<id>.run`."
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Command to execute when the shortcut matches."
|
||||
},
|
||||
"when": {
|
||||
"anyOf": [
|
||||
@@ -49,15 +52,18 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Optional expression limiting when the shortcut is active."
|
||||
}
|
||||
},
|
||||
"required": ["key", "command"],
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Single keybinding rule entry in `keybindings.json`."
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"maxItems": 256
|
||||
"maxItems": 256,
|
||||
"description": "Ordered list of custom keybinding rules persisted in `keybindings.json`."
|
||||
}
|
||||
]
|
||||
}
|
||||
+85
-41
@@ -1,29 +1,37 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "T3 Code Server Settings",
|
||||
"description": "JSON Schema for the server-authoritative settings.json file consumed by T3 Code.",
|
||||
"description": "Server-authoritative settings persisted in `settings.json`.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"description": "Optional JSON Schema reference for editor tooling. May point to the stable or versioned T3 Code settings schema URL."
|
||||
},
|
||||
"enableAssistantStreaming": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "Show token-by-token output while a response is in progress."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Show token-by-token output while a response is in progress."
|
||||
},
|
||||
"defaultThreadEnvMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["local", "worktree"]
|
||||
"enum": ["local", "worktree"],
|
||||
"description": "Pick the default workspace mode for newly created draft threads."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Pick the default workspace mode for newly created draft threads."
|
||||
},
|
||||
"textGenerationModelSelection": {
|
||||
"anyOf": [
|
||||
@@ -34,10 +42,12 @@
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["codex"]
|
||||
"enum": ["codex"],
|
||||
"description": "The provider used for text generation."
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "The Codex model slug to use for text generation."
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
@@ -51,7 +61,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Reasoning depth for Codex text generation. Higher values trade latency and cost for stronger reasoning."
|
||||
},
|
||||
"fastMode": {
|
||||
"anyOf": [
|
||||
@@ -61,24 +72,29 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether to prefer Codex fast mode when the selected model supports it."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Optional Codex-specific tuning knobs for the selected model."
|
||||
}
|
||||
},
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Text generation model selection for the Codex provider."
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["claudeAgent"]
|
||||
"enum": ["claudeAgent"],
|
||||
"description": "The provider used for text generation."
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "The Claude model slug to use for text generation."
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
@@ -91,7 +107,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether Claude should enable extended thinking for the selected model."
|
||||
},
|
||||
"effort": {
|
||||
"anyOf": [
|
||||
@@ -102,7 +119,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Reasoning effort for Claude text generation. Higher values trade latency and cost for stronger reasoning."
|
||||
},
|
||||
"fastMode": {
|
||||
"anyOf": [
|
||||
@@ -112,7 +130,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether to prefer Claude fast mode when the selected model supports it."
|
||||
},
|
||||
"contextWindow": {
|
||||
"anyOf": [
|
||||
@@ -122,21 +141,26 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Optional Claude context window preset to request for the selected model, if supported."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Optional Claude-specific tuning knobs for the selected model."
|
||||
}
|
||||
},
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Text generation model selection for the Claude provider."
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Configure the model used for generated commit messages, PR titles, and similar Git text."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Configure the model used for generated commit messages, PR titles, and similar Git text."
|
||||
},
|
||||
"providers": {
|
||||
"anyOf": [
|
||||
@@ -151,32 +175,38 @@
|
||||
"enabled": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "Whether the Codex provider is enabled and available for selection."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether the Codex provider is enabled and available for selection."
|
||||
},
|
||||
"binaryPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Path to the Codex binary"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Path to the Codex binary"
|
||||
},
|
||||
"homePath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Optional custom Codex home and config directory."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Optional custom Codex home and config directory."
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
@@ -184,20 +214,24 @@
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"description": "Additional Codex model slugs to surface in the UI alongside discovered defaults."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Additional Codex model slugs to surface in the UI alongside discovered defaults."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Configuration for the Codex provider."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Configuration for the Codex provider."
|
||||
},
|
||||
"claudeAgent": {
|
||||
"anyOf": [
|
||||
@@ -207,22 +241,26 @@
|
||||
"enabled": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "Whether the Claude provider is enabled and available for selection."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether the Claude provider is enabled and available for selection."
|
||||
},
|
||||
"binaryPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Path to the Claude binary"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Path to the Claude binary"
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
@@ -230,28 +268,34 @@
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"description": "Additional Claude model slugs to surface in the UI alongside discovered defaults."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Additional Claude model slugs to surface in the UI alongside discovered defaults."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Configuration for the Claude provider."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Configuration for the Claude provider."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Provider-specific server configuration."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Provider-specific server configuration."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
+85
-41
@@ -1,29 +1,37 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "T3 Code Server Settings",
|
||||
"description": "JSON Schema for the server-authoritative settings.json file consumed by T3 Code.",
|
||||
"description": "Server-authoritative settings persisted in `settings.json`.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"description": "Optional JSON Schema reference for editor tooling. May point to the stable or versioned T3 Code settings schema URL."
|
||||
},
|
||||
"enableAssistantStreaming": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "Whether server-driven assistant responses should stream incrementally to clients when the active provider supports it."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Show token-by-token output while a response is in progress."
|
||||
},
|
||||
"defaultThreadEnvMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["local", "worktree"]
|
||||
"enum": ["local", "worktree"],
|
||||
"description": "Default execution environment to use when creating new threads."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Pick the default workspace mode for newly created draft threads."
|
||||
},
|
||||
"textGenerationModelSelection": {
|
||||
"anyOf": [
|
||||
@@ -34,10 +42,12 @@
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["codex"]
|
||||
"enum": ["codex"],
|
||||
"description": "The provider used for text generation."
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "The Codex model slug to use for text generation."
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
@@ -51,7 +61,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Reasoning depth for Codex text generation. Higher values trade latency and cost for stronger reasoning."
|
||||
},
|
||||
"fastMode": {
|
||||
"anyOf": [
|
||||
@@ -61,24 +72,29 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether to prefer Codex fast mode when the selected model supports it."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Optional Codex-specific tuning knobs for the selected model."
|
||||
}
|
||||
},
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Text generation model selection for the Codex provider."
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["claudeAgent"]
|
||||
"enum": ["claudeAgent"],
|
||||
"description": "The provider used for text generation."
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "The Claude model slug to use for text generation."
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
@@ -91,7 +107,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether Claude should enable extended thinking for the selected model."
|
||||
},
|
||||
"effort": {
|
||||
"anyOf": [
|
||||
@@ -102,7 +119,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Reasoning effort for Claude text generation. Higher values trade latency and cost for stronger reasoning."
|
||||
},
|
||||
"fastMode": {
|
||||
"anyOf": [
|
||||
@@ -112,7 +130,8 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether to prefer Claude fast mode when the selected model supports it."
|
||||
},
|
||||
"contextWindow": {
|
||||
"anyOf": [
|
||||
@@ -122,21 +141,26 @@
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Optional Claude context window preset to request for the selected model, if supported."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Optional Claude-specific tuning knobs for the selected model."
|
||||
}
|
||||
},
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Text generation model selection for the Claude provider."
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Default provider and model to use for server-side text generation features."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Configure the model used for generated commit messages, PR titles, and similar Git text."
|
||||
},
|
||||
"providers": {
|
||||
"anyOf": [
|
||||
@@ -151,32 +175,38 @@
|
||||
"enabled": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "Whether the Codex provider is enabled and available for selection."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether the Codex provider is enabled and available for selection."
|
||||
},
|
||||
"binaryPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Path to the Codex executable. Leave blank to resolve the `codex` executable from PATH."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Path to the Codex binary"
|
||||
},
|
||||
"homePath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Optional Codex home directory. Leave blank to use the default provider-managed location."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Optional custom Codex home and config directory."
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
@@ -184,20 +214,24 @@
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"description": "Additional Codex model slugs to surface in the UI alongside discovered defaults."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Additional Codex model slugs to surface in the UI alongside discovered defaults."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Configuration for the Codex provider."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Configuration for the Codex provider."
|
||||
},
|
||||
"claudeAgent": {
|
||||
"anyOf": [
|
||||
@@ -207,22 +241,26 @@
|
||||
"enabled": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
"type": "boolean",
|
||||
"description": "Whether the Claude provider is enabled and available for selection."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Whether the Claude provider is enabled and available for selection."
|
||||
},
|
||||
"binaryPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
"type": "string",
|
||||
"description": "Path to the Claude executable. Leave blank to resolve the `claude` executable from PATH."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Path to the Claude binary"
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
@@ -230,28 +268,34 @@
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"description": "Additional Claude model slugs to surface in the UI alongside discovered defaults."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Additional Claude model slugs to surface in the UI alongside discovered defaults."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Configuration for the Claude provider."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Configuration for the Claude provider."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
"additionalProperties": false,
|
||||
"description": "Provider-specific server configuration."
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
],
|
||||
"description": "Provider-specific server configuration."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
@@ -226,7 +226,7 @@ it.layer(NodeServices.layer)("server settings", (it) => {
|
||||
serverConfig.settingsPath,
|
||||
`${JSON.stringify(
|
||||
{
|
||||
$schema: "https://t3.chat/schemas/server-settings/0.0.15.schema.json",
|
||||
$schema: "https://t3.codes/schemas/settings/0.0.15.json",
|
||||
providers: {
|
||||
codex: {
|
||||
binaryPath: "/usr/local/bin/codex",
|
||||
@@ -250,7 +250,7 @@ it.layer(NodeServices.layer)("server settings", (it) => {
|
||||
|
||||
const raw = yield* fileSystem.readFileString(serverConfig.settingsPath);
|
||||
assert.deepEqual(JSON.parse(raw), {
|
||||
$schema: "https://t3.chat/schemas/server-settings/0.0.15.schema.json",
|
||||
$schema: "https://t3.codes/schemas/settings/0.0.15.json",
|
||||
providers: {
|
||||
codex: {
|
||||
binaryPath: "/usr/local/bin/codex",
|
||||
|
||||
@@ -12,14 +12,19 @@ import {
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import {
|
||||
ClaudeSettings,
|
||||
ClientSettingsSchema,
|
||||
CodexSettings,
|
||||
PROVIDER_DISPLAY_NAMES,
|
||||
type ProviderKind,
|
||||
type ServerProvider,
|
||||
type ServerProviderModel,
|
||||
ServerSettings,
|
||||
ThreadId,
|
||||
} from "@t3tools/contracts";
|
||||
import { DEFAULT_UNIFIED_SETTINGS } from "@t3tools/contracts/settings";
|
||||
import { normalizeModelSlug } from "@t3tools/shared/model";
|
||||
import { getSchemaDescription } from "@t3tools/shared/schemaJson";
|
||||
import { Equal } from "effect";
|
||||
import { APP_VERSION } from "../../branding";
|
||||
import {
|
||||
@@ -81,6 +86,51 @@ const TIMESTAMP_FORMAT_LABELS = {
|
||||
"24-hour": "24-hour",
|
||||
} as const;
|
||||
|
||||
function requireSchemaDescription(
|
||||
schema: Parameters<typeof getSchemaDescription>[0],
|
||||
label: string,
|
||||
) {
|
||||
const description = getSchemaDescription(schema);
|
||||
if (!description) {
|
||||
throw new Error(`Missing schema description for ${label}`);
|
||||
}
|
||||
return description;
|
||||
}
|
||||
|
||||
const SETTINGS_DESCRIPTIONS = {
|
||||
timestampFormat: requireSchemaDescription(
|
||||
ClientSettingsSchema.fields.timestampFormat,
|
||||
"ClientSettings.timestampFormat",
|
||||
),
|
||||
diffWordWrap: requireSchemaDescription(
|
||||
ClientSettingsSchema.fields.diffWordWrap,
|
||||
"ClientSettings.diffWordWrap",
|
||||
),
|
||||
confirmThreadArchive: requireSchemaDescription(
|
||||
ClientSettingsSchema.fields.confirmThreadArchive,
|
||||
"ClientSettings.confirmThreadArchive",
|
||||
),
|
||||
confirmThreadDelete: requireSchemaDescription(
|
||||
ClientSettingsSchema.fields.confirmThreadDelete,
|
||||
"ClientSettings.confirmThreadDelete",
|
||||
),
|
||||
enableAssistantStreaming: requireSchemaDescription(
|
||||
ServerSettings.fields.enableAssistantStreaming,
|
||||
"ServerSettings.enableAssistantStreaming",
|
||||
),
|
||||
defaultThreadEnvMode: requireSchemaDescription(
|
||||
ServerSettings.fields.defaultThreadEnvMode,
|
||||
"ServerSettings.defaultThreadEnvMode",
|
||||
),
|
||||
textGenerationModelSelection: requireSchemaDescription(
|
||||
ServerSettings.fields.textGenerationModelSelection,
|
||||
"ServerSettings.textGenerationModelSelection",
|
||||
),
|
||||
codexBinaryPath: requireSchemaDescription(CodexSettings.fields.binaryPath, "Codex.binaryPath"),
|
||||
codexHomePath: requireSchemaDescription(CodexSettings.fields.homePath, "Codex.homePath"),
|
||||
claudeBinaryPath: requireSchemaDescription(ClaudeSettings.fields.binaryPath, "Claude.binaryPath"),
|
||||
} as const;
|
||||
|
||||
const EMPTY_SERVER_PROVIDERS: ReadonlyArray<ServerProvider> = [];
|
||||
|
||||
type InstallProviderSettings = {
|
||||
@@ -98,16 +148,16 @@ const PROVIDER_SETTINGS: readonly InstallProviderSettings[] = [
|
||||
provider: "codex",
|
||||
title: "Codex",
|
||||
binaryPlaceholder: "Codex binary path",
|
||||
binaryDescription: "Path to the Codex binary",
|
||||
binaryDescription: SETTINGS_DESCRIPTIONS.codexBinaryPath,
|
||||
homePathKey: "codexHomePath",
|
||||
homePlaceholder: "CODEX_HOME",
|
||||
homeDescription: "Optional custom Codex home and config directory.",
|
||||
homeDescription: SETTINGS_DESCRIPTIONS.codexHomePath,
|
||||
},
|
||||
{
|
||||
provider: "claudeAgent",
|
||||
title: "Claude",
|
||||
binaryPlaceholder: "Claude binary path",
|
||||
binaryDescription: "Path to the Claude binary",
|
||||
binaryDescription: SETTINGS_DESCRIPTIONS.claudeBinaryPath,
|
||||
},
|
||||
] as const;
|
||||
|
||||
@@ -774,7 +824,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Time format"
|
||||
description="System default follows your browser or OS clock preference."
|
||||
description={SETTINGS_DESCRIPTIONS.timestampFormat}
|
||||
resetAction={
|
||||
settings.timestampFormat !== DEFAULT_UNIFIED_SETTINGS.timestampFormat ? (
|
||||
<SettingResetButton
|
||||
@@ -816,7 +866,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Diff line wrapping"
|
||||
description="Set the default wrap state when the diff panel opens."
|
||||
description={SETTINGS_DESCRIPTIONS.diffWordWrap}
|
||||
resetAction={
|
||||
settings.diffWordWrap !== DEFAULT_UNIFIED_SETTINGS.diffWordWrap ? (
|
||||
<SettingResetButton
|
||||
@@ -840,7 +890,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Assistant output"
|
||||
description="Show token-by-token output while a response is in progress."
|
||||
description={SETTINGS_DESCRIPTIONS.enableAssistantStreaming}
|
||||
resetAction={
|
||||
settings.enableAssistantStreaming !==
|
||||
DEFAULT_UNIFIED_SETTINGS.enableAssistantStreaming ? (
|
||||
@@ -867,7 +917,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="New threads"
|
||||
description="Pick the default workspace mode for newly created draft threads."
|
||||
description={SETTINGS_DESCRIPTIONS.defaultThreadEnvMode}
|
||||
resetAction={
|
||||
settings.defaultThreadEnvMode !== DEFAULT_UNIFIED_SETTINGS.defaultThreadEnvMode ? (
|
||||
<SettingResetButton
|
||||
@@ -908,7 +958,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Archive confirmation"
|
||||
description="Require a second click on the inline archive action before a thread is archived."
|
||||
description={SETTINGS_DESCRIPTIONS.confirmThreadArchive}
|
||||
resetAction={
|
||||
settings.confirmThreadArchive !== DEFAULT_UNIFIED_SETTINGS.confirmThreadArchive ? (
|
||||
<SettingResetButton
|
||||
@@ -934,7 +984,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Delete confirmation"
|
||||
description="Ask before deleting a thread and its chat history."
|
||||
description={SETTINGS_DESCRIPTIONS.confirmThreadDelete}
|
||||
resetAction={
|
||||
settings.confirmThreadDelete !== DEFAULT_UNIFIED_SETTINGS.confirmThreadDelete ? (
|
||||
<SettingResetButton
|
||||
@@ -960,7 +1010,7 @@ export function GeneralSettingsPanel() {
|
||||
|
||||
<SettingsRow
|
||||
title="Text generation model"
|
||||
description="Configure the model used for generated commit messages, PR titles, and similar Git text."
|
||||
description={SETTINGS_DESCRIPTIONS.textGenerationModelSelection}
|
||||
resetAction={
|
||||
isGitWritingModelDirty ? (
|
||||
<SettingResetButton
|
||||
|
||||
@@ -176,13 +176,13 @@
|
||||
"vite": "^8.0.0",
|
||||
},
|
||||
"catalog": {
|
||||
"@effect/language-service": "0.84.1",
|
||||
"@effect/platform-node": "4.0.0-beta.42",
|
||||
"@effect/sql-sqlite-bun": "4.0.0-beta.42",
|
||||
"@effect/vitest": "4.0.0-beta.42",
|
||||
"@effect/language-service": "0.84.2",
|
||||
"@effect/platform-node": "4.0.0-beta.43",
|
||||
"@effect/sql-sqlite-bun": "4.0.0-beta.43",
|
||||
"@effect/vitest": "4.0.0-beta.43",
|
||||
"@types/bun": "^1.3.9",
|
||||
"@types/node": "^24.10.13",
|
||||
"effect": "4.0.0-beta.42",
|
||||
"effect": "4.0.0-beta.43",
|
||||
"tsdown": "^0.20.3",
|
||||
"typescript": "^5.7.3",
|
||||
"vitest": "^4.0.0",
|
||||
@@ -268,15 +268,15 @@
|
||||
|
||||
"@dnd-kit/utilities": ["@dnd-kit/[email protected]", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "react": ">=16.8.0" } }, "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg=="],
|
||||
|
||||
"@effect/language-service": ["@effect/[email protected].1", "", { "bin": { "effect-language-service": "cli.js" } }, "sha512-YUqjJU24HeYgPV453cR2fDqkZ+zZKMuxGnmxWAPscWJ6gt6FB7JZohMCOczRTIOGPrQMcloJX7BjCaPu+RNhpw=="],
|
||||
"@effect/language-service": ["@effect/[email protected].2", "", { "bin": { "effect-language-service": "cli.js" } }, "sha512-l04qNxpiA8rY5yXWckRPJ7Mk5MNerXuNymSFf+IdflfI5i8jgL1bpBNLuP6ijg7wgjdHc/KmTnCj2kT0SCntuA=="],
|
||||
|
||||
"@effect/platform-node": ["@effect/[email protected]2", "", { "dependencies": { "@effect/platform-node-shared": "^4.0.0-beta.42", "mime": "^4.1.0", "undici": "^7.24.0" }, "peerDependencies": { "effect": "^4.0.0-beta.42", "ioredis": "^5.7.0" } }, "sha512-kbdRML2FBa4q8U8rZQcnmLKZ5zN/z1bAA7t5D1/UsBHZqJgnfRgu1CP6kaEfb1Nie6YyaWshxTktZQryjvW/Yg=="],
|
||||
"@effect/platform-node": ["@effect/[email protected]3", "", { "dependencies": { "@effect/platform-node-shared": "^4.0.0-beta.43", "mime": "^4.1.0", "undici": "^7.24.0" }, "peerDependencies": { "effect": "^4.0.0-beta.43", "ioredis": "^5.7.0" } }, "sha512-Uq6E1rjaIpjHauzjwoB2HzAg3battYt2Boy8XO50GoHiWCXKE6WapYZ0/AnaBx5v5qg2sOfqpuiLsUf9ZgxOkA=="],
|
||||
|
||||
"@effect/platform-node-shared": ["@effect/[email protected]2", "", { "dependencies": { "@types/ws": "^8.18.1", "ws": "^8.19.0" }, "peerDependencies": { "effect": "^4.0.0-beta.42" } }, "sha512-PC+lxLsrwob3+nBChAPrQq32olCeyApgXBvs1NrRsoArLViNT76T/68CttuCAksCZj5e1bZ1ZibLPel3vUmx2g=="],
|
||||
"@effect/platform-node-shared": ["@effect/[email protected]3", "", { "dependencies": { "@types/ws": "^8.18.1", "ws": "^8.19.0" }, "peerDependencies": { "effect": "^4.0.0-beta.43" } }, "sha512-A9q0GEb61pYcQ06Dr6gXj1nKlDI3KHsar1sk3qb1ZY+kVSR64tBAylI8zGon23KY+NPtTUj/sEIToB7jc3Qt5w=="],
|
||||
|
||||
"@effect/sql-sqlite-bun": ["@effect/[email protected]2", "", { "peerDependencies": { "effect": "^4.0.0-beta.42" } }, "sha512-Ah2QfkeV+I9r5OBVJijSDnFXCv51giBXngSwhju5gefc0uWiM3G1tsYAqrNX24HlvFFEnOAZqNf/Sq1h4NqOAA=="],
|
||||
"@effect/sql-sqlite-bun": ["@effect/[email protected]3", "", { "peerDependencies": { "effect": "^4.0.0-beta.43" } }, "sha512-Ryb7x0rBjW5NHegbzvz9y2Yv4KpwZ1UiPk7/Rv+Mkux74Qkjdmotmrvy9P+M5A9TZyL2Av+GpaLTPJKsL0PG+Q=="],
|
||||
|
||||
"@effect/vitest": ["@effect/[email protected]2", "", { "peerDependencies": { "effect": "^4.0.0-beta.42", "vitest": "^3.0.0 || ^4.0.0" } }, "sha512-/11arjUnCRhIrBRvOn/nrbg5p/FadjAPvStddZlpl1VrCxtB2s0n39cbG9uTyDdf1ZrRBG73Upo1ZDF1CTWy8w=="],
|
||||
"@effect/vitest": ["@effect/[email protected]3", "", { "peerDependencies": { "effect": "^4.0.0-beta.43", "vitest": "^3.0.0 || ^4.0.0" } }, "sha512-XN2LAwiUWPqbV2jrsYYRjrVydQ8MIgwr83MVImtUaOQco4vk43+8OHlXQMRN/u2HnGK29KT+O2yTMMBdk2Q6Sw=="],
|
||||
|
||||
"@electron/get": ["@electron/[email protected]", "", { "dependencies": { "debug": "^4.1.1", "env-paths": "^2.2.0", "fs-extra": "^8.1.0", "got": "^11.8.5", "progress": "^2.0.3", "semver": "^6.2.0", "sumchecker": "^3.0.1" }, "optionalDependencies": { "global-agent": "^3.0.0" } }, "sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ=="],
|
||||
|
||||
@@ -1020,7 +1020,7 @@
|
||||
|
||||
"dunder-proto": ["[email protected]", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
|
||||
|
||||
"effect": ["[email protected]2", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "fast-check": "^4.5.3", "find-my-way-ts": "^0.1.6", "ini": "^6.0.0", "kubernetes-types": "^1.30.0", "msgpackr": "^1.11.8", "multipasta": "^0.2.7", "toml": "^3.0.0", "uuid": "^13.0.0", "yaml": "^2.8.2" } }, "sha512-c1UrRP+tLzyHb4Fepl8XBDJlLQLkrcMXrRBba441GQRxMbeQ/aIOSFcBwSda1iMJ5l9F0lYc3Bhe33/whrmavQ=="],
|
||||
"effect": ["[email protected]3", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "fast-check": "^4.5.3", "find-my-way-ts": "^0.1.6", "ini": "^6.0.0", "kubernetes-types": "^1.30.0", "msgpackr": "^1.11.8", "multipasta": "^0.2.7", "toml": "^3.0.0", "uuid": "^13.0.0", "yaml": "^2.8.2" } }, "sha512-AJYyDimIwJOn87uUz/JzmgDc5GfjxJbXvEbTvNzMa+M3Uer344bLo/O5mMRkqc1vBleA+Ygs4+dbE3QsqOkKTQ=="],
|
||||
|
||||
"electron": ["[email protected]", "", { "dependencies": { "@electron/get": "^2.0.0", "@types/node": "^24.9.0", "extract-zip": "^2.0.1" }, "bin": { "electron": "cli.js" } }, "sha512-ett8W+yOFGDuM0vhJMamYSkrbV3LoaffzJd9GfjI96zRAxyrNqUSKqBpf/WGbQCweDxX2pkUCUfrv4wwKpsFZA=="],
|
||||
|
||||
|
||||
+2
-2
@@ -17,8 +17,8 @@ This document covers how to run desktop releases from one tag, first without sig
|
||||
- Includes Electron auto-update metadata (for example `latest*.yml` and `*.blockmap`) in release assets.
|
||||
- Publishes the CLI package (`apps/server`, npm package `t3`) with OIDC trusted publishing.
|
||||
- Signing is optional and auto-detected per platform from secrets.
|
||||
- Refreshes the marketing-site JSON Schemas for `settings.json` and `keybindings.json` at `/schemas/server-settings.schema.json` and `/schemas/keybindings.schema.json`.
|
||||
- Commits immutable versioned JSON Schema copies at `/schemas/server-settings/<version>.schema.json` and `/schemas/keybindings/<version>.schema.json`.
|
||||
- Refreshes the marketing-site JSON Schemas for `settings.json` and `keybindings.json` at `/schemas/settings.json` and `/schemas/keybindings.json`.
|
||||
- Commits immutable versioned JSON Schema copies at `/schemas/settings/<version>.json` and `/schemas/keybindings/<version>.json`.
|
||||
|
||||
## Desktop auto-update notes
|
||||
|
||||
|
||||
+5
-5
@@ -8,11 +8,11 @@
|
||||
"scripts"
|
||||
],
|
||||
"catalog": {
|
||||
"effect": "4.0.0-beta.42",
|
||||
"@effect/platform-node": "4.0.0-beta.42",
|
||||
"@effect/sql-sqlite-bun": "4.0.0-beta.42",
|
||||
"@effect/vitest": "4.0.0-beta.42",
|
||||
"@effect/language-service": "0.84.1",
|
||||
"effect": "4.0.0-beta.43",
|
||||
"@effect/platform-node": "4.0.0-beta.43",
|
||||
"@effect/sql-sqlite-bun": "4.0.0-beta.43",
|
||||
"@effect/vitest": "4.0.0-beta.43",
|
||||
"@effect/language-service": "0.84.2",
|
||||
"@types/bun": "^1.3.9",
|
||||
"@types/node": "^24.10.13",
|
||||
"tsdown": "^0.20.3",
|
||||
|
||||
@@ -46,33 +46,55 @@ export const SCRIPT_RUN_COMMAND_PATTERN = Schema.TemplateLiteral([
|
||||
Schema.isPattern(/^[a-z0-9][a-z0-9-]*$/),
|
||||
),
|
||||
Schema.Literal(".run"),
|
||||
]);
|
||||
]).annotate({
|
||||
description: "Command identifier for running a project script, formatted as `script.<id>.run`.",
|
||||
});
|
||||
|
||||
export const KeybindingCommand = Schema.Union([
|
||||
Schema.Literals(STATIC_KEYBINDING_COMMANDS),
|
||||
SCRIPT_RUN_COMMAND_PATTERN,
|
||||
]);
|
||||
]).annotate({
|
||||
description: "Command invoked when the keybinding is triggered.",
|
||||
});
|
||||
export type KeybindingCommand = typeof KeybindingCommand.Type;
|
||||
|
||||
const KeybindingValue = TrimmedString.check(
|
||||
Schema.isMinLength(1),
|
||||
Schema.isMaxLength(MAX_KEYBINDING_VALUE_LENGTH),
|
||||
);
|
||||
const KeybindingValue = TrimmedString.annotate({
|
||||
description:
|
||||
"Keyboard shortcut string such as `mod+j`, `ctrl+k`, or `shift+space`, using the T3 Code keybinding syntax.",
|
||||
}).check(Schema.isMinLength(1), Schema.isMaxLength(MAX_KEYBINDING_VALUE_LENGTH));
|
||||
|
||||
const KeybindingWhen = TrimmedString.check(
|
||||
Schema.isMinLength(1),
|
||||
Schema.isMaxLength(MAX_KEYBINDING_WHEN_LENGTH),
|
||||
);
|
||||
const KeybindingWhen = TrimmedString.annotate({
|
||||
description:
|
||||
"Optional context expression controlling when the keybinding is active, such as `terminalFocus` or `!terminalFocus`.",
|
||||
}).check(Schema.isMinLength(1), Schema.isMaxLength(MAX_KEYBINDING_WHEN_LENGTH));
|
||||
export const KeybindingRule = Schema.Struct({
|
||||
key: KeybindingValue,
|
||||
command: KeybindingCommand,
|
||||
when: Schema.optional(KeybindingWhen),
|
||||
key: KeybindingValue.pipe(
|
||||
Schema.flip,
|
||||
Schema.annotate({
|
||||
description: "Keyboard shortcut to listen for.",
|
||||
}),
|
||||
Schema.flip,
|
||||
),
|
||||
command: KeybindingCommand.pipe(
|
||||
Schema.annotate({
|
||||
description: "Command to execute when the shortcut matches.",
|
||||
}),
|
||||
),
|
||||
when: Schema.optional(KeybindingWhen).pipe(
|
||||
Schema.annotate({
|
||||
description: "Optional expression limiting when the shortcut is active.",
|
||||
}),
|
||||
),
|
||||
}).annotate({
|
||||
description: "Single keybinding rule entry in `keybindings.json`.",
|
||||
});
|
||||
export type KeybindingRule = typeof KeybindingRule.Type;
|
||||
|
||||
export const KeybindingsConfig = Schema.Array(KeybindingRule).check(
|
||||
Schema.isMaxLength(MAX_KEYBINDINGS_COUNT),
|
||||
);
|
||||
export const KeybindingsConfig = Schema.Array(KeybindingRule)
|
||||
.check(Schema.isMaxLength(MAX_KEYBINDINGS_COUNT))
|
||||
.annotate({
|
||||
description: "Ordered list of custom keybinding rules persisted in `keybindings.json`.",
|
||||
});
|
||||
export type KeybindingsConfig = typeof KeybindingsConfig.Type;
|
||||
|
||||
export const KeybindingShortcut = Schema.Struct({
|
||||
|
||||
@@ -9,16 +9,47 @@ export type ClaudeCodeEffort = (typeof CLAUDE_CODE_EFFORT_OPTIONS)[number];
|
||||
export type ProviderReasoningEffort = CodexReasoningEffort | ClaudeCodeEffort;
|
||||
|
||||
export const CodexModelOptions = Schema.Struct({
|
||||
reasoningEffort: Schema.optional(Schema.Literals(CODEX_REASONING_EFFORT_OPTIONS)),
|
||||
fastMode: Schema.optional(Schema.Boolean),
|
||||
reasoningEffort: Schema.optional(Schema.Literals(CODEX_REASONING_EFFORT_OPTIONS)).pipe(
|
||||
Schema.annotate({
|
||||
description:
|
||||
"Reasoning depth for Codex text generation. Higher values trade latency and cost for stronger reasoning.",
|
||||
}),
|
||||
),
|
||||
fastMode: Schema.optional(Schema.Boolean).pipe(
|
||||
Schema.annotate({
|
||||
description: "Whether to prefer Codex fast mode when the selected model supports it.",
|
||||
}),
|
||||
),
|
||||
}).annotate({
|
||||
description: "Provider-specific text generation options for Codex models.",
|
||||
});
|
||||
export type CodexModelOptions = typeof CodexModelOptions.Type;
|
||||
|
||||
export const ClaudeModelOptions = Schema.Struct({
|
||||
thinking: Schema.optional(Schema.Boolean),
|
||||
effort: Schema.optional(Schema.Literals(CLAUDE_CODE_EFFORT_OPTIONS)),
|
||||
fastMode: Schema.optional(Schema.Boolean),
|
||||
contextWindow: Schema.optional(Schema.String),
|
||||
thinking: Schema.optional(Schema.Boolean).pipe(
|
||||
Schema.annotate({
|
||||
description: "Whether Claude should enable extended thinking for the selected model.",
|
||||
}),
|
||||
),
|
||||
effort: Schema.optional(Schema.Literals(CLAUDE_CODE_EFFORT_OPTIONS)).pipe(
|
||||
Schema.annotate({
|
||||
description:
|
||||
"Reasoning effort for Claude text generation. Higher values trade latency and cost for stronger reasoning.",
|
||||
}),
|
||||
),
|
||||
fastMode: Schema.optional(Schema.Boolean).pipe(
|
||||
Schema.annotate({
|
||||
description: "Whether to prefer Claude fast mode when the selected model supports it.",
|
||||
}),
|
||||
),
|
||||
contextWindow: Schema.optional(Schema.String).pipe(
|
||||
Schema.annotate({
|
||||
description:
|
||||
"Optional Claude context window preset to request for the selected model, if supported.",
|
||||
}),
|
||||
),
|
||||
}).annotate({
|
||||
description: "Provider-specific text generation options for Claude models.",
|
||||
});
|
||||
export type ClaudeModelOptions = typeof ClaudeModelOptions.Type;
|
||||
|
||||
|
||||
@@ -46,20 +46,54 @@ export type ProviderSandboxMode = typeof ProviderSandboxMode.Type;
|
||||
export const DEFAULT_PROVIDER_KIND: ProviderKind = "codex";
|
||||
|
||||
export const CodexModelSelection = Schema.Struct({
|
||||
provider: Schema.Literal("codex"),
|
||||
model: TrimmedNonEmptyString,
|
||||
options: Schema.optionalKey(CodexModelOptions),
|
||||
provider: Schema.Literal("codex").pipe(
|
||||
Schema.annotate({
|
||||
description: "The provider used for text generation.",
|
||||
}),
|
||||
),
|
||||
model: TrimmedNonEmptyString.pipe(
|
||||
Schema.flip,
|
||||
Schema.annotate({
|
||||
description: "The Codex model slug to use for text generation.",
|
||||
}),
|
||||
Schema.flip,
|
||||
),
|
||||
options: Schema.optionalKey(CodexModelOptions).pipe(
|
||||
Schema.annotate({
|
||||
description: "Optional Codex-specific tuning knobs for the selected model.",
|
||||
}),
|
||||
),
|
||||
}).annotate({
|
||||
description: "Text generation model selection for the Codex provider.",
|
||||
});
|
||||
export type CodexModelSelection = typeof CodexModelSelection.Type;
|
||||
|
||||
export const ClaudeModelSelection = Schema.Struct({
|
||||
provider: Schema.Literal("claudeAgent"),
|
||||
model: TrimmedNonEmptyString,
|
||||
options: Schema.optionalKey(ClaudeModelOptions),
|
||||
provider: Schema.Literal("claudeAgent").pipe(
|
||||
Schema.annotate({
|
||||
description: "The provider used for text generation.",
|
||||
}),
|
||||
),
|
||||
model: TrimmedNonEmptyString.pipe(
|
||||
Schema.flip,
|
||||
Schema.annotate({
|
||||
description: "The Claude model slug to use for text generation.",
|
||||
}),
|
||||
Schema.flip,
|
||||
),
|
||||
options: Schema.optionalKey(ClaudeModelOptions).pipe(
|
||||
Schema.annotate({
|
||||
description: "Optional Claude-specific tuning knobs for the selected model.",
|
||||
}),
|
||||
),
|
||||
}).annotate({
|
||||
description: "Text generation model selection for the Claude provider.",
|
||||
});
|
||||
export type ClaudeModelSelection = typeof ClaudeModelSelection.Type;
|
||||
|
||||
export const ModelSelection = Schema.Union([CodexModelSelection, ClaudeModelSelection]);
|
||||
export const ModelSelection = Schema.Union([CodexModelSelection, ClaudeModelSelection]).annotate({
|
||||
description: "Selects which provider and model T3 Code should use for text generation.",
|
||||
});
|
||||
export type ModelSelection = typeof ModelSelection.Type;
|
||||
|
||||
export const RuntimeMode = Schema.Literals(["approval-required", "full-access"]);
|
||||
|
||||
@@ -23,17 +23,32 @@ export const SidebarThreadSortOrder = Schema.Literals(["updated_at", "created_at
|
||||
export type SidebarThreadSortOrder = typeof SidebarThreadSortOrder.Type;
|
||||
export const DEFAULT_SIDEBAR_THREAD_SORT_ORDER: SidebarThreadSortOrder = "updated_at";
|
||||
|
||||
const makeTrimmedStringSetting = (description: string) =>
|
||||
Schema.String.annotate({ description }).pipe(
|
||||
Schema.decodeTo(TrimmedString, SchemaTransformation.passthrough()),
|
||||
);
|
||||
|
||||
export const ClientSettingsSchema = Schema.Struct({
|
||||
confirmThreadArchive: Schema.Boolean.pipe(Schema.withDecodingDefault(() => false)),
|
||||
confirmThreadDelete: Schema.Boolean.pipe(Schema.withDecodingDefault(() => true)),
|
||||
diffWordWrap: Schema.Boolean.pipe(Schema.withDecodingDefault(() => false)),
|
||||
sidebarProjectSortOrder: SidebarProjectSortOrder.pipe(
|
||||
Schema.withDecodingDefault(() => DEFAULT_SIDEBAR_PROJECT_SORT_ORDER),
|
||||
),
|
||||
sidebarThreadSortOrder: SidebarThreadSortOrder.pipe(
|
||||
Schema.withDecodingDefault(() => DEFAULT_SIDEBAR_THREAD_SORT_ORDER),
|
||||
),
|
||||
timestampFormat: TimestampFormat.pipe(Schema.withDecodingDefault(() => DEFAULT_TIMESTAMP_FORMAT)),
|
||||
confirmThreadArchive: Schema.Boolean.annotate({
|
||||
description: "Require a second click on the inline archive action before a thread is archived.",
|
||||
}).pipe(Schema.withDecodingDefault(() => false)),
|
||||
confirmThreadDelete: Schema.Boolean.annotate({
|
||||
description: "Ask before deleting a thread and its chat history.",
|
||||
}).pipe(Schema.withDecodingDefault(() => true)),
|
||||
diffWordWrap: Schema.Boolean.annotate({
|
||||
description: "Set the default wrap state when the diff panel opens.",
|
||||
}).pipe(Schema.withDecodingDefault(() => false)),
|
||||
sidebarProjectSortOrder: SidebarProjectSortOrder.annotate({
|
||||
description: "Choose how projects are ordered in the sidebar.",
|
||||
}).pipe(Schema.withDecodingDefault(() => DEFAULT_SIDEBAR_PROJECT_SORT_ORDER)),
|
||||
sidebarThreadSortOrder: SidebarThreadSortOrder.annotate({
|
||||
description: "Choose how threads are ordered inside the selected project.",
|
||||
}).pipe(Schema.withDecodingDefault(() => DEFAULT_SIDEBAR_THREAD_SORT_ORDER)),
|
||||
timestampFormat: TimestampFormat.annotate({
|
||||
description: "System default follows your browser or OS clock preference.",
|
||||
}).pipe(Schema.withDecodingDefault(() => DEFAULT_TIMESTAMP_FORMAT)),
|
||||
}).annotate({
|
||||
description: "Client-only settings persisted locally in the browser.",
|
||||
});
|
||||
export type ClientSettings = typeof ClientSettingsSchema.Type;
|
||||
|
||||
@@ -41,11 +56,13 @@ export const DEFAULT_CLIENT_SETTINGS: ClientSettings = Schema.decodeSync(ClientS
|
||||
|
||||
// ── Server Settings (server-authoritative) ────────────────────
|
||||
|
||||
export const ThreadEnvMode = Schema.Literals(["local", "worktree"]);
|
||||
export const ThreadEnvMode = Schema.Literals(["local", "worktree"]).annotate({
|
||||
description: "Pick the default workspace mode for newly created draft threads.",
|
||||
});
|
||||
export type ThreadEnvMode = typeof ThreadEnvMode.Type;
|
||||
|
||||
const makeBinaryPathSetting = (fallback: string) =>
|
||||
TrimmedString.pipe(
|
||||
const makeBinaryPathSetting = (fallback: string, description: string) =>
|
||||
makeTrimmedStringSetting(description).pipe(
|
||||
Schema.decodeTo(
|
||||
Schema.String,
|
||||
SchemaTransformation.transformOrFail({
|
||||
@@ -57,26 +74,51 @@ const makeBinaryPathSetting = (fallback: string) =>
|
||||
);
|
||||
|
||||
export const CodexSettings = Schema.Struct({
|
||||
enabled: Schema.Boolean.pipe(Schema.withDecodingDefault(() => true)),
|
||||
binaryPath: makeBinaryPathSetting("codex"),
|
||||
homePath: TrimmedString.pipe(Schema.withDecodingDefault(() => "")),
|
||||
customModels: Schema.Array(Schema.String).pipe(Schema.withDecodingDefault(() => [])),
|
||||
enabled: Schema.Boolean.annotate({
|
||||
description: "Whether the Codex provider is enabled and available for selection.",
|
||||
}).pipe(Schema.withDecodingDefault(() => true)),
|
||||
binaryPath: makeBinaryPathSetting("codex", "Path to the Codex binary"),
|
||||
homePath: makeTrimmedStringSetting("Optional custom Codex home and config directory.").pipe(
|
||||
Schema.withDecodingDefault(() => ""),
|
||||
),
|
||||
customModels: Schema.Array(Schema.String)
|
||||
.annotate({
|
||||
description:
|
||||
"Additional Codex model slugs to surface in the UI alongside discovered defaults.",
|
||||
})
|
||||
.pipe(Schema.withDecodingDefault(() => [])),
|
||||
}).annotate({
|
||||
description: "Server-side configuration for the Codex provider.",
|
||||
});
|
||||
export type CodexSettings = typeof CodexSettings.Type;
|
||||
|
||||
export const ClaudeSettings = Schema.Struct({
|
||||
enabled: Schema.Boolean.pipe(Schema.withDecodingDefault(() => true)),
|
||||
binaryPath: makeBinaryPathSetting("claude"),
|
||||
customModels: Schema.Array(Schema.String).pipe(Schema.withDecodingDefault(() => [])),
|
||||
enabled: Schema.Boolean.annotate({
|
||||
description: "Whether the Claude provider is enabled and available for selection.",
|
||||
}).pipe(Schema.withDecodingDefault(() => true)),
|
||||
binaryPath: makeBinaryPathSetting("claude", "Path to the Claude binary"),
|
||||
customModels: Schema.Array(Schema.String)
|
||||
.annotate({
|
||||
description:
|
||||
"Additional Claude model slugs to surface in the UI alongside discovered defaults.",
|
||||
})
|
||||
.pipe(Schema.withDecodingDefault(() => [])),
|
||||
}).annotate({
|
||||
description: "Server-side configuration for the Claude provider.",
|
||||
});
|
||||
export type ClaudeSettings = typeof ClaudeSettings.Type;
|
||||
|
||||
export const ServerSettings = Schema.Struct({
|
||||
enableAssistantStreaming: Schema.Boolean.pipe(Schema.withDecodingDefault(() => false)),
|
||||
defaultThreadEnvMode: ThreadEnvMode.pipe(
|
||||
Schema.withDecodingDefault(() => "local" as const satisfies ThreadEnvMode),
|
||||
),
|
||||
textGenerationModelSelection: ModelSelection.pipe(
|
||||
enableAssistantStreaming: Schema.Boolean.annotate({
|
||||
description: "Show token-by-token output while a response is in progress.",
|
||||
}).pipe(Schema.withDecodingDefault(() => false)),
|
||||
defaultThreadEnvMode: ThreadEnvMode.annotate({
|
||||
description: "Pick the default workspace mode for newly created draft threads.",
|
||||
}).pipe(Schema.withDecodingDefault(() => "local" as const satisfies ThreadEnvMode)),
|
||||
textGenerationModelSelection: ModelSelection.annotate({
|
||||
description:
|
||||
"Configure the model used for generated commit messages, PR titles, and similar Git text.",
|
||||
}).pipe(
|
||||
Schema.withDecodingDefault(() => ({
|
||||
provider: "codex" as const,
|
||||
model: DEFAULT_GIT_TEXT_GENERATION_MODEL_BY_PROVIDER.codex,
|
||||
@@ -85,9 +127,19 @@ export const ServerSettings = Schema.Struct({
|
||||
|
||||
// Provider specific settings
|
||||
providers: Schema.Struct({
|
||||
codex: CodexSettings.pipe(Schema.withDecodingDefault(() => ({}))),
|
||||
claudeAgent: ClaudeSettings.pipe(Schema.withDecodingDefault(() => ({}))),
|
||||
}).pipe(Schema.withDecodingDefault(() => ({}))),
|
||||
codex: CodexSettings.annotate({
|
||||
description: "Configuration for the Codex provider.",
|
||||
}).pipe(Schema.withDecodingDefault(() => ({}))),
|
||||
claudeAgent: ClaudeSettings.annotate({
|
||||
description: "Configuration for the Claude provider.",
|
||||
}).pipe(Schema.withDecodingDefault(() => ({}))),
|
||||
})
|
||||
.annotate({
|
||||
description: "Provider-specific server configuration.",
|
||||
})
|
||||
.pipe(Schema.withDecodingDefault(() => ({}))),
|
||||
}).annotate({
|
||||
description: "Server-authoritative settings persisted in `settings.json`.",
|
||||
});
|
||||
export type ServerSettings = typeof ServerSettings.Type;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { Effect, Schema } from "effect";
|
||||
import { encodePrettyJsonEffect } from "./schemaJson";
|
||||
import { encodePrettyJsonEffect, getSchemaDescription, toJsonSchemaObject } from "./schemaJson";
|
||||
|
||||
it.effect("encodePrettyJsonEffect writes indented JSON", () =>
|
||||
Effect.gen(function* () {
|
||||
@@ -31,3 +31,37 @@ it.effect("encodePrettyJsonEffect writes indented JSON", () =>
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("toJsonSchemaObject hoists descriptions from wrapper nodes", () =>
|
||||
Effect.sync(() => {
|
||||
const schema = toJsonSchemaObject(
|
||||
Schema.Struct({
|
||||
enabled: Schema.Boolean.annotate({
|
||||
description: "Whether the feature is enabled.",
|
||||
}).pipe(Schema.withDecodingDefault(() => false)),
|
||||
name: Schema.String.annotate({
|
||||
description: "Human-readable display name.",
|
||||
}).check(Schema.isMinLength(1)),
|
||||
}),
|
||||
) as Record<string, unknown>;
|
||||
|
||||
const properties = schema.properties as Record<string, Record<string, unknown>>;
|
||||
const enabled = properties.enabled;
|
||||
const name = properties.name;
|
||||
|
||||
assert.isDefined(enabled);
|
||||
assert.isDefined(name);
|
||||
assert.strictEqual(enabled.description, "Whether the feature is enabled.");
|
||||
assert.strictEqual(name.description, "Human-readable display name.");
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("getSchemaDescription reads hoisted descriptions from wrapped schemas", () =>
|
||||
Effect.sync(() => {
|
||||
const enabled = Schema.Boolean.annotate({
|
||||
description: "Whether the feature is enabled.",
|
||||
}).pipe(Schema.withDecodingDefault(() => false));
|
||||
|
||||
assert.strictEqual(getSchemaDescription(enabled), "Whether the feature is enabled.");
|
||||
}),
|
||||
);
|
||||
@@ -36,6 +36,8 @@ export const decodeUnknownJsonResult = <S extends Schema.Codec<unknown, unknown,
|
||||
};
|
||||
};
|
||||
|
||||
const schemaDescriptionCache = new WeakMap<object, string | undefined>();
|
||||
|
||||
const PrettyJsonString = SchemaGetter.parseJson<string>().compose(
|
||||
SchemaGetter.stringifyJson({ space: 2 }),
|
||||
);
|
||||
@@ -57,13 +59,70 @@ export const formatSchemaError = (cause: Cause.Cause<Schema.SchemaError>) => {
|
||||
: Cause.pretty(cause);
|
||||
};
|
||||
|
||||
function hoistJsonSchemaDescriptions(value: unknown): unknown {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(hoistJsonSchemaDescriptions);
|
||||
}
|
||||
|
||||
if (!value || typeof value !== "object") {
|
||||
return value;
|
||||
}
|
||||
|
||||
const record = Object.fromEntries(
|
||||
Object.entries(value).map(([key, entry]) => [key, hoistJsonSchemaDescriptions(entry)]),
|
||||
) as Record<string, unknown>;
|
||||
|
||||
if (typeof record.description !== "string") {
|
||||
const candidates = ["allOf", "anyOf", "oneOf"]
|
||||
.flatMap((key) => (Array.isArray(record[key]) ? (record[key] as ReadonlyArray<unknown>) : []))
|
||||
.filter((candidate): candidate is Record<string, unknown> => {
|
||||
return !!candidate && typeof candidate === "object" && !Array.isArray(candidate);
|
||||
});
|
||||
|
||||
const description = candidates.find(
|
||||
(candidate) =>
|
||||
typeof candidate.description === "string" &&
|
||||
!(candidate.type === "null" && Object.keys(candidate).length <= 1),
|
||||
)?.description;
|
||||
|
||||
if (typeof description === "string") {
|
||||
record.description = description;
|
||||
}
|
||||
}
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
/** Convert an Effect Schema to a flat JSON Schema object, inlining `$defs` when present. */
|
||||
export const toJsonSchemaObject = (schema: Schema.Top): unknown => {
|
||||
const document = Schema.toJsonSchemaDocument(schema);
|
||||
if (document.definitions && Object.keys(document.definitions).length > 0) {
|
||||
return { ...document.schema, $defs: document.definitions };
|
||||
return hoistJsonSchemaDescriptions({ ...document.schema, $defs: document.definitions });
|
||||
}
|
||||
return document.schema;
|
||||
return hoistJsonSchemaDescriptions(document.schema);
|
||||
};
|
||||
|
||||
export const getSchemaDescription = (schema: Schema.Top): string | undefined => {
|
||||
if (schema && typeof schema === "object") {
|
||||
const cached = schemaDescriptionCache.get(schema);
|
||||
if (cached !== undefined || schemaDescriptionCache.has(schema)) {
|
||||
return cached;
|
||||
}
|
||||
}
|
||||
|
||||
const jsonSchema = toJsonSchemaObject(schema);
|
||||
const description =
|
||||
jsonSchema && typeof jsonSchema === "object" && !Array.isArray(jsonSchema)
|
||||
? typeof (jsonSchema as Record<string, unknown>).description === "string"
|
||||
? ((jsonSchema as Record<string, unknown>).description as string)
|
||||
: undefined
|
||||
: undefined;
|
||||
|
||||
if (schema && typeof schema === "object") {
|
||||
schemaDescriptionCache.set(schema, description);
|
||||
}
|
||||
|
||||
return description;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,12 +58,13 @@ export function writeJsonSchemaArtifacts(options: {
|
||||
readonly changed: boolean;
|
||||
} {
|
||||
const rootDir = resolve(options.rootDir ?? process.cwd());
|
||||
let changed = writeJsonFileIfChanged(
|
||||
const latestChanged = writeJsonFileIfChanged(
|
||||
resolve(rootDir, options.latestRelativePath),
|
||||
options.document,
|
||||
);
|
||||
let changed = latestChanged;
|
||||
|
||||
if (options.version) {
|
||||
if (options.version && latestChanged) {
|
||||
changed =
|
||||
writeJsonFileIfChanged(
|
||||
resolve(rootDir, options.getVersionedRelativePath(options.version)),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
|
||||
@@ -19,10 +19,18 @@ describe("buildKeybindingsJsonSchema", () => {
|
||||
expect(schema.title).toBe("T3 Code Keybindings");
|
||||
expect(schema.type).toBe("array");
|
||||
expect(schema.items).toMatchObject({
|
||||
description: expect.stringContaining("keybinding rule"),
|
||||
type: "object",
|
||||
properties: {
|
||||
key: expect.any(Object),
|
||||
command: expect.any(Object),
|
||||
key: {
|
||||
description: expect.stringContaining("shortcut"),
|
||||
},
|
||||
command: {
|
||||
description: expect.stringContaining("execute"),
|
||||
},
|
||||
when: {
|
||||
description: expect.stringContaining("active"),
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -47,4 +55,21 @@ describe("buildKeybindingsJsonSchema", () => {
|
||||
rmSync(rootDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("skips writing a versioned schema file when the latest schema is unchanged", () => {
|
||||
const rootDir = mkdtempSync(join(tmpdir(), "t3-keybindings-schema-"));
|
||||
|
||||
try {
|
||||
const latestOnly = writeKeybindingsJsonSchemas({ rootDir });
|
||||
expect(latestOnly.changed).toBe(true);
|
||||
|
||||
const result = writeKeybindingsJsonSchemas({ rootDir, version: "1.2.3" });
|
||||
expect(result.changed).toBe(false);
|
||||
expect(existsSync(resolve(rootDir, getVersionedKeybindingsSchemaRelativePath("1.2.3")))).toBe(
|
||||
false,
|
||||
);
|
||||
} finally {
|
||||
rmSync(rootDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,13 +1,12 @@
|
||||
import { KeybindingsConfig } from "@t3tools/contracts";
|
||||
import { buildJsonSchemaDocument, writeJsonSchemaArtifacts } from "./json-schema";
|
||||
|
||||
export const KEYBINDINGS_SCHEMA_RELATIVE_PATH =
|
||||
"apps/marketing/public/schemas/keybindings.schema.json";
|
||||
export const KEYBINDINGS_SCHEMA_RELATIVE_PATH = "apps/marketing/public/schemas/keybindings.json";
|
||||
export const KEYBINDINGS_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH =
|
||||
"apps/marketing/public/schemas/keybindings";
|
||||
|
||||
export const getVersionedKeybindingsSchemaRelativePath = (version: string) =>
|
||||
`${KEYBINDINGS_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH}/${version}.schema.json`;
|
||||
`${KEYBINDINGS_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH}/${version}.json`;
|
||||
|
||||
export function buildKeybindingsJsonSchema(): Record<string, unknown> {
|
||||
return buildJsonSchemaDocument(KeybindingsConfig, {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
|
||||
@@ -20,10 +20,22 @@ describe("buildServerSettingsJsonSchema", () => {
|
||||
expect(schema.type).toBe("object");
|
||||
expect(schema.additionalProperties).toBe(false);
|
||||
expect(schema.properties).toMatchObject({
|
||||
enableAssistantStreaming: expect.any(Object),
|
||||
defaultThreadEnvMode: expect.any(Object),
|
||||
textGenerationModelSelection: expect.any(Object),
|
||||
providers: expect.any(Object),
|
||||
$schema: {
|
||||
type: "string",
|
||||
},
|
||||
enableAssistantStreaming: {
|
||||
description: "Show token-by-token output while a response is in progress.",
|
||||
},
|
||||
defaultThreadEnvMode: {
|
||||
description: "Pick the default workspace mode for newly created draft threads.",
|
||||
},
|
||||
textGenerationModelSelection: {
|
||||
description:
|
||||
"Configure the model used for generated commit messages, PR titles, and similar Git text.",
|
||||
},
|
||||
providers: {
|
||||
description: expect.stringContaining("Provider-specific"),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -50,4 +62,21 @@ describe("buildServerSettingsJsonSchema", () => {
|
||||
rmSync(rootDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("skips writing a versioned schema file when the latest schema is unchanged", () => {
|
||||
const rootDir = mkdtempSync(join(tmpdir(), "t3-server-settings-schema-"));
|
||||
|
||||
try {
|
||||
const latestOnly = writeServerSettingsJsonSchemas({ rootDir });
|
||||
expect(latestOnly.changed).toBe(true);
|
||||
|
||||
const result = writeServerSettingsJsonSchemas({ rootDir, version: "1.2.3" });
|
||||
expect(result.changed).toBe(false);
|
||||
expect(
|
||||
existsSync(resolve(rootDir, getVersionedServerSettingsSchemaRelativePath("1.2.3"))),
|
||||
).toBe(false);
|
||||
} finally {
|
||||
rmSync(rootDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,19 +1,42 @@
|
||||
import { ServerSettings } from "@t3tools/contracts/settings";
|
||||
import { buildJsonSchemaDocument, writeJsonSchemaArtifacts } from "./json-schema";
|
||||
|
||||
export const SERVER_SETTINGS_SCHEMA_RELATIVE_PATH =
|
||||
"apps/marketing/public/schemas/server-settings.schema.json";
|
||||
export const SERVER_SETTINGS_SCHEMA_RELATIVE_PATH = "apps/marketing/public/schemas/settings.json";
|
||||
export const SERVER_SETTINGS_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH =
|
||||
"apps/marketing/public/schemas/server-settings";
|
||||
"apps/marketing/public/schemas/settings";
|
||||
|
||||
export const getVersionedServerSettingsSchemaRelativePath = (version: string) =>
|
||||
`${SERVER_SETTINGS_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH}/${version}.schema.json`;
|
||||
`${SERVER_SETTINGS_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH}/${version}.json`;
|
||||
|
||||
export function buildServerSettingsJsonSchema(): Record<string, unknown> {
|
||||
return buildJsonSchemaDocument(ServerSettings, {
|
||||
const schema = buildJsonSchemaDocument(ServerSettings, {
|
||||
title: "T3 Code Server Settings",
|
||||
description: "JSON Schema for the server-authoritative settings.json file consumed by T3 Code.",
|
||||
});
|
||||
|
||||
const properties =
|
||||
schema.type === "object" &&
|
||||
schema.properties &&
|
||||
typeof schema.properties === "object" &&
|
||||
!Array.isArray(schema.properties)
|
||||
? schema.properties
|
||||
: null;
|
||||
|
||||
if (!properties) {
|
||||
throw new Error("ServerSettings JSON schema must expose object properties.");
|
||||
}
|
||||
|
||||
return {
|
||||
...schema,
|
||||
properties: {
|
||||
$schema: {
|
||||
type: "string",
|
||||
description:
|
||||
"Optional JSON Schema reference for editor tooling. May point to the stable or versioned T3 Code settings schema URL.",
|
||||
},
|
||||
...properties,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function writeServerSettingsJsonSchemas(options?: {
|
||||
|
||||
@@ -114,21 +114,18 @@ try {
|
||||
"Expected bun.lock to contain the smoke version.",
|
||||
);
|
||||
|
||||
const latestSchemaPath = resolve(
|
||||
tempRoot,
|
||||
"apps/marketing/public/schemas/server-settings.schema.json",
|
||||
);
|
||||
const latestSchemaPath = resolve(tempRoot, "apps/marketing/public/schemas/settings.json");
|
||||
const versionedSchemaPath = resolve(
|
||||
tempRoot,
|
||||
"apps/marketing/public/schemas/server-settings/9.9.9-smoke.0.schema.json",
|
||||
"apps/marketing/public/schemas/settings/9.9.9-smoke.0.json",
|
||||
);
|
||||
const latestKeybindingsSchemaPath = resolve(
|
||||
tempRoot,
|
||||
"apps/marketing/public/schemas/keybindings.schema.json",
|
||||
"apps/marketing/public/schemas/keybindings.json",
|
||||
);
|
||||
const versionedKeybindingsSchemaPath = resolve(
|
||||
tempRoot,
|
||||
"apps/marketing/public/schemas/keybindings/9.9.9-smoke.0.schema.json",
|
||||
"apps/marketing/public/schemas/keybindings/9.9.9-smoke.0.json",
|
||||
);
|
||||
if (!existsSync(latestSchemaPath)) {
|
||||
throw new Error(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { existsSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
|
||||
@@ -8,6 +8,8 @@ import {
|
||||
releasePackageFiles,
|
||||
updateReleasePackageVersions,
|
||||
} from "./update-release-package-versions";
|
||||
import { writeKeybindingsJsonSchemas } from "./lib/keybindings-schema";
|
||||
import { writeServerSettingsJsonSchemas } from "./lib/server-settings-schema";
|
||||
|
||||
describe("updateReleasePackageVersions", () => {
|
||||
it("updates package versions and writes latest plus versioned config schemas", () => {
|
||||
@@ -33,10 +35,16 @@ describe("updateReleasePackageVersions", () => {
|
||||
expect(packageJson.version).toBe("1.2.3");
|
||||
}
|
||||
|
||||
expect(
|
||||
JSON.parse(
|
||||
readFileSync(resolve(rootDir, "apps/marketing/public/schemas/settings.json"), "utf8"),
|
||||
),
|
||||
).toMatchObject({ title: "T3 Code Server Settings" });
|
||||
|
||||
expect(
|
||||
JSON.parse(
|
||||
readFileSync(
|
||||
resolve(rootDir, "apps/marketing/public/schemas/server-settings.schema.json"),
|
||||
resolve(rootDir, "apps/marketing/public/schemas/settings/1.2.3.json"),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
@@ -44,26 +52,14 @@ describe("updateReleasePackageVersions", () => {
|
||||
|
||||
expect(
|
||||
JSON.parse(
|
||||
readFileSync(
|
||||
resolve(rootDir, "apps/marketing/public/schemas/server-settings/1.2.3.schema.json"),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
).toMatchObject({ title: "T3 Code Server Settings" });
|
||||
|
||||
expect(
|
||||
JSON.parse(
|
||||
readFileSync(
|
||||
resolve(rootDir, "apps/marketing/public/schemas/keybindings.schema.json"),
|
||||
"utf8",
|
||||
),
|
||||
readFileSync(resolve(rootDir, "apps/marketing/public/schemas/keybindings.json"), "utf8"),
|
||||
),
|
||||
).toMatchObject({ title: "T3 Code Keybindings" });
|
||||
|
||||
expect(
|
||||
JSON.parse(
|
||||
readFileSync(
|
||||
resolve(rootDir, "apps/marketing/public/schemas/keybindings/1.2.3.schema.json"),
|
||||
resolve(rootDir, "apps/marketing/public/schemas/keybindings/1.2.3.json"),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
@@ -72,4 +68,34 @@ describe("updateReleasePackageVersions", () => {
|
||||
rmSync(rootDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("skips versioned schema snapshots when the latest schemas are unchanged", () => {
|
||||
const rootDir = mkdtempSync(join(tmpdir(), "t3-release-version-bump-"));
|
||||
|
||||
try {
|
||||
for (const relativePath of releasePackageFiles) {
|
||||
const filePath = resolve(rootDir, relativePath);
|
||||
mkdirSync(dirname(filePath), { recursive: true });
|
||||
writeFileSync(
|
||||
filePath,
|
||||
`${JSON.stringify({ name: relativePath, version: "1.2.3" }, null, 2)}\n`,
|
||||
);
|
||||
}
|
||||
|
||||
writeServerSettingsJsonSchemas({ rootDir });
|
||||
writeKeybindingsJsonSchemas({ rootDir });
|
||||
|
||||
const result = updateReleasePackageVersions("1.2.3", { rootDir });
|
||||
expect(result.changed).toBe(false);
|
||||
|
||||
expect(
|
||||
existsSync(resolve(rootDir, "apps/marketing/public/schemas/settings/1.2.3.json")),
|
||||
).toBe(false);
|
||||
expect(
|
||||
existsSync(resolve(rootDir, "apps/marketing/public/schemas/keybindings/1.2.3.json")),
|
||||
).toBe(false);
|
||||
} finally {
|
||||
rmSync(rootDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user