Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
782716bd83 | ||
|
|
f1793ad2eb | ||
|
|
805c68dd0e | ||
|
|
e835adeb16 |
No files matched your search
@@ -126,7 +126,7 @@ jobs:
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Align package versions to release version
|
||||
run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
|
||||
run: bun scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
|
||||
|
||||
- name: Build desktop artifact
|
||||
shell: bash
|
||||
@@ -248,7 +248,7 @@ jobs:
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Align package versions to release version
|
||||
run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
|
||||
run: bun scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
|
||||
|
||||
- name: Build CLI package
|
||||
run: bun run build --filter=@t3tools/web --filter=t3
|
||||
@@ -348,7 +348,7 @@ jobs:
|
||||
name: Update version strings
|
||||
env:
|
||||
RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
|
||||
run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
|
||||
run: bun scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
|
||||
|
||||
- name: Format package.json files
|
||||
if: steps.update_versions.outputs.changed == 'true'
|
||||
@@ -364,7 +364,7 @@ jobs:
|
||||
env:
|
||||
RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
|
||||
run: |
|
||||
if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock; then
|
||||
if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json apps/marketing/public/schemas bun.lock; then
|
||||
echo "No version changes to commit."
|
||||
exit 0
|
||||
fi
|
||||
@@ -372,6 +372,6 @@ jobs:
|
||||
git config user.name "${{ steps.app_bot.outputs.name }}"
|
||||
git config user.email "${{ steps.app_bot.outputs.email }}"
|
||||
|
||||
git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock
|
||||
git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json apps/marketing/public/schemas bun.lock
|
||||
git commit -m "chore(release): prepare $RELEASE_TAG"
|
||||
git push origin HEAD:main
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"$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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"command": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"terminal.toggle",
|
||||
"terminal.split",
|
||||
"terminal.new",
|
||||
"terminal.close",
|
||||
"diff.toggle",
|
||||
"chat.new",
|
||||
"chat.newLocal",
|
||||
"editor.openFavorite",
|
||||
"thread.previous",
|
||||
"thread.next",
|
||||
"thread.jump.1",
|
||||
"thread.jump.2",
|
||||
"thread.jump.3",
|
||||
"thread.jump.4",
|
||||
"thread.jump.5",
|
||||
"thread.jump.6",
|
||||
"thread.jump.7",
|
||||
"thread.jump.8",
|
||||
"thread.jump.9"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^script\\.[\\s\\S]*?\\.run$"
|
||||
}
|
||||
]
|
||||
},
|
||||
"when": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["key", "command"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"maxItems": 256
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"$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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string"
|
||||
},
|
||||
"command": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"terminal.toggle",
|
||||
"terminal.split",
|
||||
"terminal.new",
|
||||
"terminal.close",
|
||||
"diff.toggle",
|
||||
"chat.new",
|
||||
"chat.newLocal",
|
||||
"editor.openFavorite",
|
||||
"thread.previous",
|
||||
"thread.next",
|
||||
"thread.jump.1",
|
||||
"thread.jump.2",
|
||||
"thread.jump.3",
|
||||
"thread.jump.4",
|
||||
"thread.jump.5",
|
||||
"thread.jump.6",
|
||||
"thread.jump.7",
|
||||
"thread.jump.8",
|
||||
"thread.jump.9"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^script\\.[\\s\\S]*?\\.run$"
|
||||
}
|
||||
]
|
||||
},
|
||||
"when": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["key", "command"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"maxItems": 256
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
{
|
||||
"$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.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enableAssistantStreaming": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"defaultThreadEnvMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["local", "worktree"]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"textGenerationModelSelection": {
|
||||
"anyOf": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["codex"]
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"reasoningEffort": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["xhigh", "high", "medium", "low"]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fastMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["claudeAgent"]
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"thinking": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"effort": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["low", "medium", "high", "max", "ultrathink"]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fastMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"contextWindow": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"providers": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"codex": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"binaryPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"homePath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"claudeAgent": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"binaryPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
{
|
||||
"$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.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enableAssistantStreaming": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"defaultThreadEnvMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["local", "worktree"]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"textGenerationModelSelection": {
|
||||
"anyOf": [
|
||||
{
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["codex"]
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"reasoningEffort": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["xhigh", "high", "medium", "low"]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fastMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"type": "string",
|
||||
"enum": ["claudeAgent"]
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"thinking": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"effort": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"enum": ["low", "medium", "high", "max", "ultrathink"]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fastMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"contextWindow": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": ["provider", "model"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"providers": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"codex": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"binaryPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"homePath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"claudeAgent": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"binaryPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"customModels": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
||||
import { ClaudeModelSelection } from "@t3tools/contracts";
|
||||
import { resolveApiModelId } from "@t3tools/shared/model";
|
||||
import { sanitizeBranchFragment, sanitizeFeatureBranchName } from "@t3tools/shared/git";
|
||||
import { toJsonSchemaObject } from "@t3tools/shared/schemaJson";
|
||||
|
||||
import { TextGenerationError } from "../Errors.ts";
|
||||
import { type TextGenerationShape, TextGeneration } from "../Services/TextGeneration.ts";
|
||||
@@ -27,7 +28,6 @@ import {
|
||||
sanitizeCommitSubject,
|
||||
sanitizePrTitle,
|
||||
sanitizeThreadTitle,
|
||||
toJsonSchemaObject,
|
||||
} from "../Utils.ts";
|
||||
import { normalizeClaudeModelOptionsWithCapabilities } from "@t3tools/shared/model";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
|
||||
@@ -5,6 +5,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
import { CodexModelSelection } from "@t3tools/contracts";
|
||||
import { sanitizeBranchFragment, sanitizeFeatureBranchName } from "@t3tools/shared/git";
|
||||
import { toJsonSchemaObject } from "@t3tools/shared/schemaJson";
|
||||
|
||||
import { resolveAttachmentPath } from "../../attachmentStore.ts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
@@ -26,7 +27,6 @@ import {
|
||||
sanitizeCommitSubject,
|
||||
sanitizePrTitle,
|
||||
sanitizeThreadTitle,
|
||||
toJsonSchemaObject,
|
||||
} from "../Utils.ts";
|
||||
import { getCodexModelCapabilities } from "../../provider/Layers/CodexProvider.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
|
||||
@@ -14,15 +14,6 @@ export function isGitRepository(cwd: string): boolean {
|
||||
return existsSync(join(cwd, ".git"));
|
||||
}
|
||||
|
||||
/** Convert an Effect Schema to a flat JSON Schema object, inlining `$defs` when present. */
|
||||
export function 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 document.schema;
|
||||
}
|
||||
|
||||
/** Truncate a text section to `maxChars`, appending a `[truncated]` marker when needed. */
|
||||
export function limitSection(value: string, maxChars: number): string {
|
||||
if (value.length <= maxChars) return value;
|
||||
|
||||
@@ -34,7 +34,6 @@ import {
|
||||
Predicate,
|
||||
PubSub,
|
||||
Schema,
|
||||
SchemaGetter,
|
||||
SchemaIssue,
|
||||
SchemaTransformation,
|
||||
Ref,
|
||||
@@ -44,7 +43,7 @@ import {
|
||||
} from "effect";
|
||||
import * as Semaphore from "effect/Semaphore";
|
||||
import { ServerConfig } from "./config";
|
||||
import { fromLenientJson } from "@t3tools/shared/schemaJson";
|
||||
import { encodePrettyJsonEffect, fromLenientJson } from "@t3tools/shared/schemaJson";
|
||||
|
||||
export class KeybindingsConfigError extends Schema.TaggedErrorClass<KeybindingsConfigError>()(
|
||||
"KeybindingsConfigParseError",
|
||||
@@ -418,16 +417,7 @@ function encodeWhenAst(node: KeybindingWhenNode): string {
|
||||
const DEFAULT_RESOLVED_KEYBINDINGS = compileResolvedKeybindingsConfig(DEFAULT_KEYBINDINGS);
|
||||
|
||||
const RawKeybindingsEntries = fromLenientJson(Schema.Array(Schema.Unknown));
|
||||
const KeybindingsConfigJson = Schema.fromJsonString(KeybindingsConfig);
|
||||
const PrettyJsonString = SchemaGetter.parseJson<string>().compose(
|
||||
SchemaGetter.stringifyJson({ space: 2 }),
|
||||
);
|
||||
const KeybindingsConfigPrettyJson = KeybindingsConfigJson.pipe(
|
||||
Schema.encode({
|
||||
decode: PrettyJsonString,
|
||||
encode: PrettyJsonString,
|
||||
}),
|
||||
);
|
||||
const encodeKeybindingsConfigPrettyJson = encodePrettyJsonEffect(KeybindingsConfig);
|
||||
|
||||
export interface KeybindingsConfigState {
|
||||
readonly keybindings: ResolvedKeybindingsConfig;
|
||||
@@ -676,7 +666,7 @@ const makeKeybindings = Effect.gen(function* () {
|
||||
const writeConfigAtomically = (rules: readonly KeybindingRule[]) => {
|
||||
const tempPath = `${keybindingsConfigPath}.${process.pid}.${Date.now()}.tmp`;
|
||||
|
||||
return Schema.encodeEffect(KeybindingsConfigPrettyJson)(rules).pipe(
|
||||
return encodeKeybindingsConfigPrettyJson(rules).pipe(
|
||||
Effect.map((encoded) => `${encoded}\n`),
|
||||
Effect.tap(() => fs.makeDirectory(path.dirname(keybindingsConfigPath), { recursive: true })),
|
||||
Effect.tap((encoded) => fs.writeFileString(tempPath, encoded)),
|
||||
|
||||
@@ -216,4 +216,50 @@ it.layer(NodeServices.layer)("server settings", (it) => {
|
||||
});
|
||||
}).pipe(Effect.provide(makeServerSettingsLayer())),
|
||||
);
|
||||
|
||||
it.effect("preserves a top-level $schema declaration when rewriting settings", () =>
|
||||
Effect.gen(function* () {
|
||||
const serverConfig = yield* ServerConfig;
|
||||
const fileSystem = yield* FileSystem.FileSystem;
|
||||
|
||||
yield* fileSystem.writeFileString(
|
||||
serverConfig.settingsPath,
|
||||
`${JSON.stringify(
|
||||
{
|
||||
$schema: "https://t3.chat/schemas/server-settings/0.0.15.schema.json",
|
||||
providers: {
|
||||
codex: {
|
||||
binaryPath: "/usr/local/bin/codex",
|
||||
},
|
||||
},
|
||||
},
|
||||
null,
|
||||
2,
|
||||
)}\n`,
|
||||
);
|
||||
|
||||
const serverSettings = yield* ServerSettingsService;
|
||||
yield* serverSettings.start;
|
||||
yield* serverSettings.updateSettings({
|
||||
providers: {
|
||||
claudeAgent: {
|
||||
binaryPath: "/usr/local/bin/claude",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const raw = yield* fileSystem.readFileString(serverConfig.settingsPath);
|
||||
assert.deepEqual(JSON.parse(raw), {
|
||||
$schema: "https://t3.chat/schemas/server-settings/0.0.15.schema.json",
|
||||
providers: {
|
||||
codex: {
|
||||
binaryPath: "/usr/local/bin/codex",
|
||||
},
|
||||
claudeAgent: {
|
||||
binaryPath: "/usr/local/bin/claude",
|
||||
},
|
||||
},
|
||||
});
|
||||
}).pipe(Effect.provide(makeServerSettingsLayer())),
|
||||
);
|
||||
});
|
||||
@@ -39,7 +39,7 @@ import {
|
||||
import * as Semaphore from "effect/Semaphore";
|
||||
import { ServerConfig } from "./config";
|
||||
import { type DeepPartial, deepMerge } from "@t3tools/shared/Struct";
|
||||
import { fromLenientJson } from "@t3tools/shared/schemaJson";
|
||||
import { encodePrettyJsonEffect, fromLenientJson } from "@t3tools/shared/schemaJson";
|
||||
|
||||
export class ServerSettingsError extends Schema.TaggedErrorClass<ServerSettingsError>()(
|
||||
"ServerSettingsError",
|
||||
@@ -101,6 +101,9 @@ export class ServerSettingsService extends ServiceMap.Service<
|
||||
}
|
||||
|
||||
const ServerSettingsJson = fromLenientJson(ServerSettings);
|
||||
const UnknownJson = fromLenientJson(Schema.Unknown);
|
||||
const encodeServerSettingsDocument = encodePrettyJsonEffect(Schema.Unknown);
|
||||
const SETTINGS_SCHEMA_DECLARATION_KEY = "$schema";
|
||||
|
||||
const PROVIDER_ORDER: readonly ProviderKind[] = ["codex", "claudeAgent"];
|
||||
|
||||
@@ -177,6 +180,7 @@ const makeServerSettings = Effect.gen(function* () {
|
||||
const changesPubSub = yield* PubSub.unbounded<ServerSettings>();
|
||||
const startedRef = yield* Ref.make(false);
|
||||
const startedDeferred = yield* Deferred.make<void, ServerSettingsError>();
|
||||
const schemaDeclarationRef = yield* Ref.make<string | undefined>(undefined);
|
||||
const watcherScope = yield* Scope.make("sequential");
|
||||
yield* Effect.addFinalizer(() => Scope.close(watcherScope, Exit.void));
|
||||
|
||||
@@ -207,10 +211,25 @@ const makeServerSettings = Effect.gen(function* () {
|
||||
|
||||
const loadSettingsFromDisk = Effect.gen(function* () {
|
||||
if (!(yield* readConfigExists)) {
|
||||
yield* Ref.set(schemaDeclarationRef, undefined);
|
||||
return DEFAULT_SERVER_SETTINGS;
|
||||
}
|
||||
|
||||
const raw = yield* readRawConfig;
|
||||
const rawJson = Schema.decodeUnknownExit(UnknownJson)(raw);
|
||||
if (rawJson._tag === "Success") {
|
||||
const value = rawJson.value;
|
||||
const valueRecord =
|
||||
value && typeof value === "object" && !Array.isArray(value)
|
||||
? (value as Record<string, unknown>)
|
||||
: undefined;
|
||||
const schemaDeclaration =
|
||||
valueRecord && typeof valueRecord[SETTINGS_SCHEMA_DECLARATION_KEY] === "string"
|
||||
? valueRecord[SETTINGS_SCHEMA_DECLARATION_KEY]
|
||||
: undefined;
|
||||
yield* Ref.set(schemaDeclarationRef, schemaDeclaration);
|
||||
}
|
||||
|
||||
const decoded = Schema.decodeUnknownExit(ServerSettingsJson)(raw);
|
||||
if (decoded._tag === "Failure") {
|
||||
yield* Effect.logWarning("failed to parse settings.json, using defaults", {
|
||||
@@ -232,7 +251,17 @@ const makeServerSettings = Effect.gen(function* () {
|
||||
const tempPath = `${settingsPath}.${process.pid}.${Date.now()}.tmp`;
|
||||
const sparseSettings = stripDefaultServerSettings(settings, DEFAULT_SERVER_SETTINGS) ?? {};
|
||||
|
||||
return Effect.succeed(`${JSON.stringify(sparseSettings, null, 2)}\n`).pipe(
|
||||
return Ref.get(schemaDeclarationRef).pipe(
|
||||
Effect.map((schemaDeclaration) =>
|
||||
schemaDeclaration
|
||||
? {
|
||||
[SETTINGS_SCHEMA_DECLARATION_KEY]: schemaDeclaration,
|
||||
...sparseSettings,
|
||||
}
|
||||
: sparseSettings,
|
||||
),
|
||||
Effect.flatMap(encodeServerSettingsDocument),
|
||||
Effect.map((encoded) => `${encoded}\n`),
|
||||
Effect.tap(() => fs.makeDirectory(pathService.dirname(settingsPath), { recursive: true })),
|
||||
Effect.tap((encoded) => fs.writeFileString(tempPath, encoded)),
|
||||
Effect.flatMap(() => fs.rename(tempPath, settingsPath)),
|
||||
|
||||
@@ -17,6 +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`.
|
||||
|
||||
## Desktop auto-update notes
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { Effect, Schema } from "effect";
|
||||
import { encodePrettyJsonEffect } from "./schemaJson";
|
||||
|
||||
it.effect("encodePrettyJsonEffect writes indented JSON", () =>
|
||||
Effect.gen(function* () {
|
||||
const encodePrettyJson = encodePrettyJsonEffect(
|
||||
Schema.Struct({
|
||||
provider: Schema.String,
|
||||
options: Schema.Struct({
|
||||
enabled: Schema.Boolean,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
const encoded = yield* encodePrettyJson({
|
||||
provider: "codex",
|
||||
options: {
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
encoded,
|
||||
`{
|
||||
"provider": "codex",
|
||||
"options": {
|
||||
"enabled": true
|
||||
}
|
||||
}`,
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -36,6 +36,20 @@ export const decodeUnknownJsonResult = <S extends Schema.Codec<unknown, unknown,
|
||||
};
|
||||
};
|
||||
|
||||
const PrettyJsonString = SchemaGetter.parseJson<string>().compose(
|
||||
SchemaGetter.stringifyJson({ space: 2 }),
|
||||
);
|
||||
|
||||
export const encodePrettyJsonEffect = <S extends Schema.Top>(schema: S) =>
|
||||
Schema.encodeEffect(
|
||||
Schema.fromJsonString(schema).pipe(
|
||||
Schema.encode({
|
||||
decode: PrettyJsonString,
|
||||
encode: PrettyJsonString,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
export const formatSchemaError = (cause: Cause.Cause<Schema.SchemaError>) => {
|
||||
const squashed = Cause.squash(cause);
|
||||
return Schema.isSchemaError(squashed)
|
||||
@@ -43,6 +57,15 @@ export const formatSchemaError = (cause: Cause.Cause<Schema.SchemaError>) => {
|
||||
: Cause.pretty(cause);
|
||||
};
|
||||
|
||||
/** 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 document.schema;
|
||||
};
|
||||
|
||||
/**
|
||||
* A `Getter` that parses a lenient JSON string (tolerating trailing commas
|
||||
* and JS-style comments) into an unknown value.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import {
|
||||
KEYBINDINGS_SCHEMA_RELATIVE_PATH,
|
||||
writeKeybindingsJsonSchemas,
|
||||
} from "./lib/keybindings-schema.ts";
|
||||
import {
|
||||
SERVER_SETTINGS_SCHEMA_RELATIVE_PATH,
|
||||
writeServerSettingsJsonSchemas,
|
||||
} from "./lib/server-settings-schema.ts";
|
||||
|
||||
const rootDir = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
|
||||
writeServerSettingsJsonSchemas({ rootDir });
|
||||
writeKeybindingsJsonSchemas({ rootDir });
|
||||
|
||||
console.log(`Wrote ${SERVER_SETTINGS_SCHEMA_RELATIVE_PATH}`);
|
||||
console.log(`Wrote ${KEYBINDINGS_SCHEMA_RELATIVE_PATH}`);
|
||||
@@ -0,0 +1,75 @@
|
||||
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
|
||||
import { type Schema } from "effect";
|
||||
|
||||
import { toJsonSchemaObject } from "@t3tools/shared/schemaJson";
|
||||
|
||||
const JSON_SCHEMA_DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
||||
|
||||
export function buildJsonSchemaDocument(
|
||||
schema: Schema.Top,
|
||||
options: {
|
||||
readonly title: string;
|
||||
readonly description: string;
|
||||
},
|
||||
): Record<string, unknown> {
|
||||
const jsonSchema = toJsonSchemaObject(schema);
|
||||
if (!jsonSchema || typeof jsonSchema !== "object" || Array.isArray(jsonSchema)) {
|
||||
throw new Error(
|
||||
`${options.title} JSON schema must be an object or array JSON schema document.`,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
...jsonSchema,
|
||||
$schema: JSON_SCHEMA_DRAFT_2020_12,
|
||||
title: options.title,
|
||||
description: options.description,
|
||||
};
|
||||
}
|
||||
|
||||
function writeJsonFileIfChanged(filePath: string, document: Record<string, unknown>): boolean {
|
||||
const nextContent = `${JSON.stringify(document, null, 2)}\n`;
|
||||
const previousContent = (() => {
|
||||
try {
|
||||
return readFileSync(filePath, "utf8");
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
})();
|
||||
|
||||
if (previousContent === nextContent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mkdirSync(dirname(filePath), { recursive: true });
|
||||
writeFileSync(filePath, nextContent);
|
||||
return true;
|
||||
}
|
||||
|
||||
export function writeJsonSchemaArtifacts(options: {
|
||||
readonly rootDir?: string;
|
||||
readonly version?: string;
|
||||
readonly latestRelativePath: string;
|
||||
readonly getVersionedRelativePath: (version: string) => string;
|
||||
readonly document: Record<string, unknown>;
|
||||
}): {
|
||||
readonly changed: boolean;
|
||||
} {
|
||||
const rootDir = resolve(options.rootDir ?? process.cwd());
|
||||
let changed = writeJsonFileIfChanged(
|
||||
resolve(rootDir, options.latestRelativePath),
|
||||
options.document,
|
||||
);
|
||||
|
||||
if (options.version) {
|
||||
changed =
|
||||
writeJsonFileIfChanged(
|
||||
resolve(rootDir, options.getVersionedRelativePath(options.version)),
|
||||
options.document,
|
||||
) || changed;
|
||||
}
|
||||
|
||||
return { changed };
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
buildKeybindingsJsonSchema,
|
||||
getVersionedKeybindingsSchemaRelativePath,
|
||||
KEYBINDINGS_SCHEMA_RELATIVE_PATH,
|
||||
writeKeybindingsJsonSchemas,
|
||||
} from "./keybindings-schema";
|
||||
|
||||
describe("buildKeybindingsJsonSchema", () => {
|
||||
it("builds a JSON schema document for keybindings.json", () => {
|
||||
const schema = buildKeybindingsJsonSchema();
|
||||
|
||||
expect(schema.$schema).toBe("https://json-schema.org/draft/2020-12/schema");
|
||||
expect(schema.title).toBe("T3 Code Keybindings");
|
||||
expect(schema.type).toBe("array");
|
||||
expect(schema.items).toMatchObject({
|
||||
type: "object",
|
||||
properties: {
|
||||
key: expect.any(Object),
|
||||
command: expect.any(Object),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("writes latest and versioned schema files", () => {
|
||||
const rootDir = mkdtempSync(join(tmpdir(), "t3-keybindings-schema-"));
|
||||
|
||||
try {
|
||||
const result = writeKeybindingsJsonSchemas({ rootDir, version: "1.2.3" });
|
||||
expect(result.changed).toBe(true);
|
||||
|
||||
const latestSchema = JSON.parse(
|
||||
readFileSync(resolve(rootDir, KEYBINDINGS_SCHEMA_RELATIVE_PATH), "utf8"),
|
||||
) as Record<string, unknown>;
|
||||
const versionedSchema = JSON.parse(
|
||||
readFileSync(resolve(rootDir, getVersionedKeybindingsSchemaRelativePath("1.2.3")), "utf8"),
|
||||
) as Record<string, unknown>;
|
||||
|
||||
expect(latestSchema).toEqual(versionedSchema);
|
||||
expect(latestSchema.title).toBe("T3 Code Keybindings");
|
||||
} finally {
|
||||
rmSync(rootDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
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_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH =
|
||||
"apps/marketing/public/schemas/keybindings";
|
||||
|
||||
export const getVersionedKeybindingsSchemaRelativePath = (version: string) =>
|
||||
`${KEYBINDINGS_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH}/${version}.schema.json`;
|
||||
|
||||
export function buildKeybindingsJsonSchema(): Record<string, unknown> {
|
||||
return buildJsonSchemaDocument(KeybindingsConfig, {
|
||||
title: "T3 Code Keybindings",
|
||||
description: "JSON Schema for the keybindings.json file consumed by T3 Code.",
|
||||
});
|
||||
}
|
||||
|
||||
export function writeKeybindingsJsonSchemas(options?: {
|
||||
readonly rootDir?: string;
|
||||
readonly version?: string;
|
||||
}): {
|
||||
readonly changed: boolean;
|
||||
} {
|
||||
return writeJsonSchemaArtifacts({
|
||||
latestRelativePath: KEYBINDINGS_SCHEMA_RELATIVE_PATH,
|
||||
getVersionedRelativePath: getVersionedKeybindingsSchemaRelativePath,
|
||||
document: buildKeybindingsJsonSchema(),
|
||||
...(options?.rootDir === undefined ? {} : { rootDir: options.rootDir }),
|
||||
...(options?.version === undefined ? {} : { version: options.version }),
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||
import { join, resolve } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
buildServerSettingsJsonSchema,
|
||||
getVersionedServerSettingsSchemaRelativePath,
|
||||
SERVER_SETTINGS_SCHEMA_RELATIVE_PATH,
|
||||
writeServerSettingsJsonSchemas,
|
||||
} from "./server-settings-schema";
|
||||
|
||||
describe("buildServerSettingsJsonSchema", () => {
|
||||
it("builds a JSON schema document for settings.json", () => {
|
||||
const schema = buildServerSettingsJsonSchema();
|
||||
|
||||
expect(schema.$schema).toBe("https://json-schema.org/draft/2020-12/schema");
|
||||
expect(schema.title).toBe("T3 Code Server Settings");
|
||||
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),
|
||||
});
|
||||
});
|
||||
|
||||
it("writes latest and versioned schema files", () => {
|
||||
const rootDir = mkdtempSync(join(tmpdir(), "t3-server-settings-schema-"));
|
||||
|
||||
try {
|
||||
const result = writeServerSettingsJsonSchemas({ rootDir, version: "1.2.3" });
|
||||
expect(result.changed).toBe(true);
|
||||
|
||||
const latestSchema = JSON.parse(
|
||||
readFileSync(resolve(rootDir, SERVER_SETTINGS_SCHEMA_RELATIVE_PATH), "utf8"),
|
||||
) as Record<string, unknown>;
|
||||
const versionedSchema = JSON.parse(
|
||||
readFileSync(
|
||||
resolve(rootDir, getVersionedServerSettingsSchemaRelativePath("1.2.3")),
|
||||
"utf8",
|
||||
),
|
||||
) as Record<string, unknown>;
|
||||
|
||||
expect(latestSchema).toEqual(versionedSchema);
|
||||
expect(latestSchema.title).toBe("T3 Code Server Settings");
|
||||
} finally {
|
||||
rmSync(rootDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
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_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH =
|
||||
"apps/marketing/public/schemas/server-settings";
|
||||
|
||||
export const getVersionedServerSettingsSchemaRelativePath = (version: string) =>
|
||||
`${SERVER_SETTINGS_VERSIONED_SCHEMA_DIRECTORY_RELATIVE_PATH}/${version}.schema.json`;
|
||||
|
||||
export function buildServerSettingsJsonSchema(): Record<string, unknown> {
|
||||
return buildJsonSchemaDocument(ServerSettings, {
|
||||
title: "T3 Code Server Settings",
|
||||
description: "JSON Schema for the server-authoritative settings.json file consumed by T3 Code.",
|
||||
});
|
||||
}
|
||||
|
||||
export function writeServerSettingsJsonSchemas(options?: {
|
||||
readonly rootDir?: string;
|
||||
readonly version?: string;
|
||||
}): {
|
||||
readonly changed: boolean;
|
||||
} {
|
||||
return writeJsonSchemaArtifacts({
|
||||
latestRelativePath: SERVER_SETTINGS_SCHEMA_RELATIVE_PATH,
|
||||
getVersionedRelativePath: getVersionedServerSettingsSchemaRelativePath,
|
||||
document: buildServerSettingsJsonSchema(),
|
||||
...(options?.rootDir === undefined ? {} : { rootDir: options.rootDir }),
|
||||
...(options?.version === undefined ? {} : { version: options.version }),
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,13 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import {
|
||||
cpSync,
|
||||
existsSync,
|
||||
mkdirSync,
|
||||
mkdtempSync,
|
||||
readFileSync,
|
||||
rmSync,
|
||||
writeFileSync,
|
||||
} from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
@@ -81,7 +89,7 @@ try {
|
||||
copyWorkspaceManifestFixture(tempRoot);
|
||||
|
||||
execFileSync(
|
||||
process.execPath,
|
||||
"bun",
|
||||
[
|
||||
resolve(repoRoot, "scripts/update-release-package-versions.ts"),
|
||||
"9.9.9-smoke.0",
|
||||
@@ -106,6 +114,55 @@ try {
|
||||
"Expected bun.lock to contain the smoke version.",
|
||||
);
|
||||
|
||||
const latestSchemaPath = resolve(
|
||||
tempRoot,
|
||||
"apps/marketing/public/schemas/server-settings.schema.json",
|
||||
);
|
||||
const versionedSchemaPath = resolve(
|
||||
tempRoot,
|
||||
"apps/marketing/public/schemas/server-settings/9.9.9-smoke.0.schema.json",
|
||||
);
|
||||
const latestKeybindingsSchemaPath = resolve(
|
||||
tempRoot,
|
||||
"apps/marketing/public/schemas/keybindings.schema.json",
|
||||
);
|
||||
const versionedKeybindingsSchemaPath = resolve(
|
||||
tempRoot,
|
||||
"apps/marketing/public/schemas/keybindings/9.9.9-smoke.0.schema.json",
|
||||
);
|
||||
if (!existsSync(latestSchemaPath)) {
|
||||
throw new Error(
|
||||
"Expected release version alignment to generate the latest server settings schema.",
|
||||
);
|
||||
}
|
||||
if (!existsSync(versionedSchemaPath)) {
|
||||
throw new Error(
|
||||
"Expected release version alignment to generate the versioned server settings schema.",
|
||||
);
|
||||
}
|
||||
if (!existsSync(latestKeybindingsSchemaPath)) {
|
||||
throw new Error(
|
||||
"Expected release version alignment to generate the latest keybindings schema.",
|
||||
);
|
||||
}
|
||||
if (!existsSync(versionedKeybindingsSchemaPath)) {
|
||||
throw new Error(
|
||||
"Expected release version alignment to generate the versioned keybindings schema.",
|
||||
);
|
||||
}
|
||||
const versionedSchema = readFileSync(versionedSchemaPath, "utf8");
|
||||
assertContains(
|
||||
versionedSchema,
|
||||
'"title": "T3 Code Server Settings"',
|
||||
"Expected versioned server settings schema to contain schema metadata.",
|
||||
);
|
||||
const versionedKeybindingsSchema = readFileSync(versionedKeybindingsSchemaPath, "utf8");
|
||||
assertContains(
|
||||
versionedKeybindingsSchema,
|
||||
'"title": "T3 Code Keybindings"',
|
||||
"Expected versioned keybindings schema to contain schema metadata.",
|
||||
);
|
||||
|
||||
const { arm64Path, x64Path } = writeMacManifestFixtures(tempRoot);
|
||||
execFileSync(
|
||||
process.execPath,
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import { mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
releasePackageFiles,
|
||||
updateReleasePackageVersions,
|
||||
} from "./update-release-package-versions";
|
||||
|
||||
describe("updateReleasePackageVersions", () => {
|
||||
it("updates package versions and writes latest plus versioned config schemas", () => {
|
||||
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: "0.0.0" }, null, 2)}\n`,
|
||||
);
|
||||
}
|
||||
|
||||
const result = updateReleasePackageVersions("1.2.3", { rootDir });
|
||||
expect(result.changed).toBe(true);
|
||||
|
||||
for (const relativePath of releasePackageFiles) {
|
||||
const packageJson = JSON.parse(readFileSync(resolve(rootDir, relativePath), "utf8")) as {
|
||||
version?: string;
|
||||
};
|
||||
expect(packageJson.version).toBe("1.2.3");
|
||||
}
|
||||
|
||||
expect(
|
||||
JSON.parse(
|
||||
readFileSync(
|
||||
resolve(rootDir, "apps/marketing/public/schemas/server-settings.schema.json"),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
).toMatchObject({ title: "T3 Code Server Settings" });
|
||||
|
||||
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",
|
||||
),
|
||||
),
|
||||
).toMatchObject({ title: "T3 Code Keybindings" });
|
||||
|
||||
expect(
|
||||
JSON.parse(
|
||||
readFileSync(
|
||||
resolve(rootDir, "apps/marketing/public/schemas/keybindings/1.2.3.schema.json"),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
).toMatchObject({ title: "T3 Code Keybindings" });
|
||||
} finally {
|
||||
rmSync(rootDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -2,6 +2,9 @@ import { appendFileSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { writeKeybindingsJsonSchemas } from "./lib/keybindings-schema.ts";
|
||||
import { writeServerSettingsJsonSchemas } from "./lib/server-settings-schema.ts";
|
||||
|
||||
export const releasePackageFiles = [
|
||||
"apps/server/package.json",
|
||||
"apps/desktop/package.json",
|
||||
@@ -37,6 +40,9 @@ export function updateReleasePackageVersions(
|
||||
changed = true;
|
||||
}
|
||||
|
||||
changed = writeServerSettingsJsonSchemas({ rootDir, version }).changed || changed;
|
||||
changed = writeKeybindingsJsonSchemas({ rootDir, version }).changed || changed;
|
||||
|
||||
return { changed };
|
||||
}
|
||||
|
||||
@@ -99,7 +105,7 @@ if (isMain) {
|
||||
);
|
||||
|
||||
if (!changed) {
|
||||
console.log("All package.json versions already match release version.");
|
||||
console.log("All release version artifacts already match the requested version.");
|
||||
}
|
||||
|
||||
if (writeGithubOutput) {
|
||||
|
||||
Reference in new issue
Block a user