diff --git a/apps/web/src/filePathDisplay.test.ts b/apps/web/src/filePathDisplay.test.ts
new file mode 100644
index 0000000000..c196b5677b
--- /dev/null
+++ b/apps/web/src/filePathDisplay.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, it } from "vitest";
+
+import { formatWorkspaceRelativePath } from "./filePathDisplay";
+
+describe("formatWorkspaceRelativePath", () => {
+ it("formats absolute workspace paths from the workspace root", () => {
+ expect(
+ formatWorkspaceRelativePath(
+ "C:/Users/mike/dev-stuff/t3code/apps/web/src/session-logic.ts:501",
+ "C:/Users/mike/dev-stuff/t3code",
+ ),
+ ).toBe("t3code/apps/web/src/session-logic.ts:501");
+ });
+
+ it("prefixes relative paths with the workspace root label", () => {
+ expect(
+ formatWorkspaceRelativePath(
+ "apps/web/src/session-logic.ts:501",
+ "C:/Users/mike/dev-stuff/t3code",
+ ),
+ ).toBe("t3code/apps/web/src/session-logic.ts:501");
+ });
+
+ it("keeps paths already rooted at the workspace label stable", () => {
+ expect(
+ formatWorkspaceRelativePath(
+ "t3code/apps/web/src/session-logic.ts:501",
+ "C:/Users/mike/dev-stuff/t3code",
+ ),
+ ).toBe("t3code/apps/web/src/session-logic.ts:501");
+ });
+
+ it("preserves columns when present", () => {
+ expect(
+ formatWorkspaceRelativePath(
+ "/C:/Users/mike/dev-stuff/t3code/apps/web/src/session-logic.ts:501:9",
+ "C:/Users/mike/dev-stuff/t3code",
+ ),
+ ).toBe("t3code/apps/web/src/session-logic.ts:501:9");
+ });
+});
diff --git a/apps/web/src/filePathDisplay.ts b/apps/web/src/filePathDisplay.ts
new file mode 100644
index 0000000000..5a6e2a02e1
--- /dev/null
+++ b/apps/web/src/filePathDisplay.ts
@@ -0,0 +1,57 @@
+import { splitPathAndPosition } from "./terminal-links";
+
+function normalizePathSeparators(path: string): string {
+ return path.replaceAll("\\", "/");
+}
+
+function canonicalizeWindowsDrivePath(path: string): string {
+ return /^\/[A-Za-z]:\//.test(path) ? path.slice(1) : path;
+}
+
+function trimTrailingPathSeparators(path: string): string {
+ return path.replace(/[\\/]+$/, "");
+}
+
+function basenameOfPath(path: string): string {
+ const separatorIndex = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
+ return separatorIndex >= 0 ? path.slice(separatorIndex + 1) : path;
+}
+
+function stripRelativePrefixes(path: string): string {
+ return path.replace(/^\.\/+/, "").replace(/^\/+/, "");
+}
+
+export function formatWorkspaceRelativePath(
+ pathWithPosition: string,
+ workspaceRoot: string | undefined,
+): string {
+ const { path, line, column } = splitPathAndPosition(pathWithPosition);
+ const normalizedPath = canonicalizeWindowsDrivePath(normalizePathSeparators(path));
+
+ let displayPath = normalizedPath;
+ if (workspaceRoot) {
+ const normalizedWorkspaceRoot = canonicalizeWindowsDrivePath(
+ normalizePathSeparators(trimTrailingPathSeparators(workspaceRoot)),
+ );
+ const workspaceLabel = basenameOfPath(normalizedWorkspaceRoot);
+ const pathForCompare = normalizedPath.toLowerCase();
+ const workspaceForCompare = normalizedWorkspaceRoot.toLowerCase();
+ const workspaceWithSeparator = `${workspaceForCompare}/`;
+ const workspaceLabelWithSeparator = `${workspaceLabel.toLowerCase()}/`;
+
+ if (pathForCompare === workspaceForCompare) {
+ displayPath = workspaceLabel;
+ } else if (pathForCompare.startsWith(workspaceWithSeparator)) {
+ const relativeSuffix = normalizedPath.slice(normalizedWorkspaceRoot.length + 1);
+ displayPath = `${workspaceLabel}/${relativeSuffix}`;
+ } else if (!normalizedPath.startsWith("/")) {
+ const relativePath = stripRelativePrefixes(normalizedPath);
+ displayPath = pathForCompare.startsWith(workspaceLabelWithSeparator)
+ ? normalizedPath
+ : `${workspaceLabel}/${relativePath}`;
+ }
+ }
+
+ if (!line) return displayPath;
+ return `${displayPath}:${line}${column ? `:${column}` : ""}`;
+}
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index 833fb1d8d6..6a4db39855 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -324,6 +324,47 @@ label:has(> select#reasoning-effort) select {
font-size: 0.75rem;
}
+.chat-markdown-file-link {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.28rem;
+ border: 1px solid color-mix(in srgb, var(--border) 92%, transparent);
+ border-radius: 0.375rem;
+ background: color-mix(in srgb, var(--muted) 88%, var(--background));
+ padding: 0.08rem 0.34rem;
+ color: var(--foreground);
+ font-family: var(--font-mono, ui-monospace, monospace);
+ font-size: 0.75rem;
+ line-height: 1.15;
+ vertical-align: text-bottom;
+ transition:
+ background-color 120ms ease,
+ border-color 120ms ease,
+ color 120ms ease,
+ opacity 120ms ease;
+}
+
+.chat-markdown-file-link:hover {
+ opacity: 1;
+ color: var(--foreground);
+ border-color: color-mix(in srgb, var(--border) 65%, var(--foreground));
+ background: color-mix(in srgb, var(--muted) 72%, var(--background));
+}
+
+.chat-markdown-file-link:focus-visible {
+ outline: none;
+ box-shadow: 0 0 0 1px color-mix(in srgb, var(--ring) 70%, transparent);
+}
+
+.chat-markdown-file-link-icon {
+ opacity: 0.72;
+}
+
+.chat-markdown-file-link-label {
+ color: color-mix(in srgb, var(--foreground) 88%, transparent);
+ line-height: 1.1;
+}
+
.chat-markdown pre {
max-width: 100%;
overflow-x: auto;
@@ -340,6 +381,24 @@ label:has(> select#reasoning-effort) select {
font-size: 0.75rem;
}
+.markdown-file-link-tooltip-scroll {
+ scrollbar-width: thin;
+ scrollbar-color: color-mix(in srgb, var(--border) 78%, transparent) transparent;
+}
+
+.markdown-file-link-tooltip-scroll::-webkit-scrollbar {
+ height: 6px;
+}
+
+.markdown-file-link-tooltip-scroll::-webkit-scrollbar-track {
+ background: transparent;
+}
+
+.markdown-file-link-tooltip-scroll::-webkit-scrollbar-thumb {
+ border-radius: 999px;
+ background: color-mix(in srgb, var(--border) 78%, transparent);
+}
+
.chat-markdown .chat-markdown-codeblock {
--chat-markdown-codeblock-copy-button-space: 1.5rem;
position: relative;
diff --git a/apps/web/src/markdown-links.test.ts b/apps/web/src/markdown-links.test.ts
index d3ca8bc99a..a49512d8ec 100644
--- a/apps/web/src/markdown-links.test.ts
+++ b/apps/web/src/markdown-links.test.ts
@@ -1,6 +1,10 @@
import { describe, expect, it } from "vitest";
-import { resolveMarkdownFileLinkTarget, rewriteMarkdownFileUriHref } from "./markdown-links";
+import {
+ resolveMarkdownFileLinkMeta,
+ resolveMarkdownFileLinkTarget,
+ rewriteMarkdownFileUriHref,
+} from "./markdown-links";
describe("rewriteMarkdownFileUriHref", () => {
it("rewrites file uri hrefs into direct path hrefs", () => {
@@ -57,6 +61,29 @@ describe("resolveMarkdownFileLinkTarget", () => {
);
});
+ it("formats tooltip display paths relative to the cwd when possible", () => {
+ expect(
+ resolveMarkdownFileLinkMeta(
+ "file:///C:/Users/mike/dev-stuff/t3code/apps/web/src/session-logic.ts#L501",
+ "C:/Users/mike/dev-stuff/t3code",
+ ),
+ ).toMatchObject({
+ displayPath: "t3code/apps/web/src/session-logic.ts:501",
+ });
+ });
+
+ it("formats tooltip display paths relative to the cwd for slash-prefixed windows paths", () => {
+ expect(
+ resolveMarkdownFileLinkMeta(
+ "/C:/Users/mike/dev-stuff/t3code/apps/web/src/components/chat/MessagesTimeline.virtualization.browser.tsx",
+ "C:/Users/mike/dev-stuff/t3code",
+ ),
+ ).toMatchObject({
+ displayPath:
+ "t3code/apps/web/src/components/chat/MessagesTimeline.virtualization.browser.tsx",
+ });
+ });
+
it("does not treat app routes as file links", () => {
expect(resolveMarkdownFileLinkTarget("/chat/settings")).toBeNull();
});
diff --git a/apps/web/src/markdown-links.ts b/apps/web/src/markdown-links.ts
index b5dcab0100..003fb0409d 100644
--- a/apps/web/src/markdown-links.ts
+++ b/apps/web/src/markdown-links.ts
@@ -1,4 +1,5 @@
-import { resolvePathLinkTarget } from "./terminal-links";
+import { formatWorkspaceRelativePath } from "./filePathDisplay";
+import { resolvePathLinkTarget, splitPathAndPosition } from "./terminal-links";
const WINDOWS_DRIVE_PATH_PATTERN = /^[A-Za-z]:[\\/]/;
const WINDOWS_UNC_PATH_PATTERN = /^\\\\/;
@@ -21,6 +22,15 @@ const POSIX_FILE_ROOT_PREFIXES = [
"/root/",
] as const;
+export interface MarkdownFileLinkMeta {
+ filePath: string;
+ targetPath: string;
+ displayPath: string;
+ basename: string;
+ line?: number;
+ column?: number;
+}
+
function safeDecode(value: string): string {
try {
return decodeURIComponent(value);
@@ -143,3 +153,31 @@ export function resolveMarkdownFileLinkTarget(
if (!cwd) return null;
return resolvePathLinkTarget(pathWithPosition, cwd);
}
+
+function basenameOfPath(path: string): string {
+ const separatorIndex = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
+ return separatorIndex >= 0 ? path.slice(separatorIndex + 1) : path;
+}
+
+export function resolveMarkdownFileLinkMeta(
+ href: string | undefined,
+ cwd?: string,
+): MarkdownFileLinkMeta | null {
+ const targetPath = resolveMarkdownFileLinkTarget(href, cwd);
+ if (!targetPath) return null;
+
+ const { path, line, column } = splitPathAndPosition(targetPath);
+ const parsedLine = line ? Number.parseInt(line, 10) : Number.NaN;
+ const parsedColumn = column ? Number.parseInt(column, 10) : Number.NaN;
+ const lineNumber = Number.isFinite(parsedLine) ? parsedLine : undefined;
+ const columnNumber = Number.isFinite(parsedColumn) ? parsedColumn : undefined;
+
+ return {
+ filePath: path,
+ targetPath,
+ displayPath: formatWorkspaceRelativePath(targetPath, cwd),
+ basename: basenameOfPath(path),
+ ...(lineNumber !== undefined ? { line: lineNumber } : {}),
+ ...(columnNumber !== undefined ? { column: columnNumber } : {}),
+ };
+}
diff --git a/apps/web/src/terminal-links.ts b/apps/web/src/terminal-links.ts
index 0d40a90e41..a4eeda4279 100644
--- a/apps/web/src/terminal-links.ts
+++ b/apps/web/src/terminal-links.ts
@@ -137,7 +137,7 @@ function inferHomeFromCwd(cwd: string): string | undefined {
return undefined;
}
-function splitPathAndPosition(value: string): {
+export function splitPathAndPosition(value: string): {
path: string;
line: string | undefined;
column: string | undefined;
diff --git a/docs/release.md b/docs/release.md
index 7486dc6960..fc17d3e39d 100644
--- a/docs/release.md
+++ b/docs/release.md
@@ -37,7 +37,7 @@ This document covers the unified release workflow for stable and nightly desktop
- tag format: `nightly-vX.Y.Z-nightly.YYYYMMDD.
`
- release name includes the short commit SHA
- `make_latest` is always `false`
-- Uses the current `apps/desktop/package.json` semver core (`X.Y.Z`) as the nightly base, then appends a nightly prerelease suffix.
+- Uses the next stable patch version as the nightly base. For example, `0.0.17` produces nightlies on `0.0.18-nightly.*`.
- Publishes Electron auto-update metadata to the dedicated `nightly` updater channel, so desktop users can opt into that track independently from stable.
- Publishes the CLI package (`apps/server`, npm package `t3`) to the `nightly` npm dist-tag using the same nightly version.
- Does not commit version bumps back to `main`.
diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts
index fe432e098b..375f4ed27e 100644
--- a/packages/contracts/src/settings.ts
+++ b/packages/contracts/src/settings.ts
@@ -70,6 +70,7 @@ export const ClaudeSettings = Schema.Struct({
enabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
binaryPath: makeBinaryPathSetting("claude"),
customModels: Schema.Array(Schema.String).pipe(Schema.withDecodingDefault(Effect.succeed([]))),
+ launchArgs: Schema.String.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
});
export type ClaudeSettings = typeof ClaudeSettings.Type;
@@ -164,6 +165,7 @@ const ClaudeSettingsPatch = Schema.Struct({
enabled: Schema.optionalKey(Schema.Boolean),
binaryPath: Schema.optionalKey(Schema.String),
customModels: Schema.optionalKey(Schema.Array(Schema.String)),
+ launchArgs: Schema.optionalKey(Schema.String),
});
export const ServerSettingsPatch = Schema.Struct({
diff --git a/packages/shared/package.json b/packages/shared/package.json
index d695b4d45d..a16ebc36a9 100644
--- a/packages/shared/package.json
+++ b/packages/shared/package.json
@@ -68,6 +68,10 @@
"types": "./src/qrCode.ts",
"import": "./src/qrCode.ts"
},
+ "./cliArgs": {
+ "types": "./src/cliArgs.ts",
+ "import": "./src/cliArgs.ts"
+ },
"./path": {
"types": "./src/path.ts",
"import": "./src/path.ts"
diff --git a/packages/shared/src/cliArgs.test.ts b/packages/shared/src/cliArgs.test.ts
new file mode 100644
index 0000000000..02c0b48805
--- /dev/null
+++ b/packages/shared/src/cliArgs.test.ts
@@ -0,0 +1,134 @@
+import { describe, expect, it } from "vitest";
+
+import { parseCliArgs } from "./cliArgs";
+
+describe("parseCliArgs", () => {
+ it("returns empty result for empty string", () => {
+ expect(parseCliArgs("")).toEqual({ flags: {}, positionals: [] });
+ });
+
+ it("returns empty result for whitespace-only string", () => {
+ expect(parseCliArgs(" ")).toEqual({ flags: {}, positionals: [] });
+ });
+
+ it("returns empty result for empty array", () => {
+ expect(parseCliArgs([])).toEqual({ flags: {}, positionals: [] });
+ });
+
+ it("parses --chrome boolean flag", () => {
+ expect(parseCliArgs("--chrome")).toEqual({
+ flags: { chrome: null },
+ positionals: [],
+ });
+ });
+
+ it("parses --chrome with --verbose", () => {
+ expect(parseCliArgs("--chrome --verbose")).toEqual({
+ flags: { chrome: null, verbose: null },
+ positionals: [],
+ });
+ });
+
+ it("parses --effort with a value", () => {
+ expect(parseCliArgs("--effort high")).toEqual({
+ flags: { effort: "high" },
+ positionals: [],
+ });
+ });
+
+ it("parses --chrome --effort high --debug", () => {
+ expect(parseCliArgs("--chrome --effort high --debug")).toEqual({
+ flags: { chrome: null, effort: "high", debug: null },
+ positionals: [],
+ });
+ });
+
+ it("parses --model with full model name", () => {
+ expect(parseCliArgs("--model claude-sonnet-4-6")).toEqual({
+ flags: { model: "claude-sonnet-4-6" },
+ positionals: [],
+ });
+ });
+
+ it("parses --append-system-prompt with value and --chrome", () => {
+ expect(parseCliArgs("--append-system-prompt always-think-step-by-step --chrome")).toEqual({
+ flags: { "append-system-prompt": "always-think-step-by-step", chrome: null },
+ positionals: [],
+ });
+ });
+
+ it("parses --max-budget-usd with numeric value", () => {
+ expect(parseCliArgs("--chrome --max-budget-usd 5.00")).toEqual({
+ flags: { chrome: null, "max-budget-usd": "5.00" },
+ positionals: [],
+ });
+ });
+
+ it("parses --effort=high syntax", () => {
+ expect(parseCliArgs("--effort=high")).toEqual({
+ flags: { effort: "high" },
+ positionals: [],
+ });
+ });
+
+ it("parses --key=value mixed with boolean flags", () => {
+ expect(parseCliArgs("--chrome --model=claude-sonnet-4-6 --debug")).toEqual({
+ flags: { chrome: null, model: "claude-sonnet-4-6", debug: null },
+ positionals: [],
+ });
+ });
+
+ it("collects positional arguments", () => {
+ expect(parseCliArgs("1.2.3")).toEqual({
+ flags: {},
+ positionals: ["1.2.3"],
+ });
+ });
+
+ it("collects positionals mixed with flags (argv array)", () => {
+ expect(parseCliArgs(["1.2.3", "--root", "/path", "--github-output"])).toEqual({
+ flags: { root: "/path", "github-output": null },
+ positionals: ["1.2.3"],
+ });
+ });
+
+ it("handles extra whitespace between tokens", () => {
+ expect(parseCliArgs(" --chrome --verbose ")).toEqual({
+ flags: { chrome: null, verbose: null },
+ positionals: [],
+ });
+ });
+
+ it("ignores bare -- with no flag name", () => {
+ expect(parseCliArgs("--")).toEqual({ flags: {}, positionals: [] });
+ });
+
+ it("boolean flag does not consume next token as value", () => {
+ expect(parseCliArgs(["--github-output", "1.2.3"], { booleanFlags: ["github-output"] })).toEqual(
+ {
+ flags: { "github-output": null },
+ positionals: ["1.2.3"],
+ },
+ );
+ });
+
+ it("non-boolean flag still consumes next token", () => {
+ expect(parseCliArgs(["--root", "/path", "1.2.3"], { booleanFlags: ["github-output"] })).toEqual(
+ {
+ flags: { root: "/path" },
+ positionals: ["1.2.3"],
+ },
+ );
+ });
+
+ it("mixes boolean and value flags with positionals", () => {
+ expect(
+ parseCliArgs(["--github-output", "--root", "/path", "1.2.3"], {
+ booleanFlags: ["github-output"],
+ }),
+ ).toEqual({
+ flags: { "github-output": null, root: "/path" },
+ positionals: ["1.2.3"],
+ });
+ });
+});
diff --git a/packages/shared/src/cliArgs.ts b/packages/shared/src/cliArgs.ts
new file mode 100644
index 0000000000..2092009330
--- /dev/null
+++ b/packages/shared/src/cliArgs.ts
@@ -0,0 +1,76 @@
+export interface ParsedCliArgs {
+ readonly flags: Record;
+ readonly positionals: string[];
+}
+
+export interface ParseCliArgsOptions {
+ readonly booleanFlags?: readonly string[];
+}
+
+/**
+ * Parse CLI-style arguments into flags and positionals.
+ *
+ * Accepts a string (split by whitespace) or a pre-split argv array.
+ * Supports `--key value`, `--key=value`, and `--flag` (boolean) syntax.
+ *
+ * parseCliArgs("")
+ * → { flags: {}, positionals: [] }
+ *
+ * parseCliArgs("--chrome")
+ * → { flags: { chrome: null }, positionals: [] }
+ *
+ * parseCliArgs("--chrome --effort high")
+ * → { flags: { chrome: null, effort: "high" }, positionals: [] }
+ *
+ * parseCliArgs("--effort=high")
+ * → { flags: { effort: "high" }, positionals: [] }
+ *
+ * parseCliArgs(["1.2.3", "--root", "/path", "--github-output"], { booleanFlags: ["github-output"] })
+ * → { flags: { root: "/path", "github-output": null }, positionals: ["1.2.3"] }
+ */
+export function parseCliArgs(
+ args: string | readonly string[],
+ options?: ParseCliArgsOptions,
+): ParsedCliArgs {
+ const tokens =
+ typeof args === "string" ? args.trim().split(/\s+/).filter(Boolean) : Array.from(args);
+ const booleanSet = options?.booleanFlags ? new Set(options.booleanFlags) : undefined;
+
+ const flags: Record = {};
+ const positionals: string[] = [];
+
+ for (let i = 0; i < tokens.length; i++) {
+ const token = tokens[i]!;
+
+ if (token.startsWith("--")) {
+ const rest = token.slice(2);
+ if (!rest) continue;
+
+ // Handle --key=value syntax
+ const eqIndex = rest.indexOf("=");
+ if (eqIndex !== -1) {
+ flags[rest.slice(0, eqIndex)] = rest.slice(eqIndex + 1);
+ continue;
+ }
+
+ // Known boolean flag — never consumes next token
+ if (booleanSet?.has(rest)) {
+ flags[rest] = null;
+ continue;
+ }
+
+ // Handle --key value or --flag (boolean)
+ const next = tokens[i + 1];
+ if (next !== undefined && !next.startsWith("--")) {
+ flags[rest] = next;
+ i++;
+ } else {
+ flags[rest] = null;
+ }
+ } else {
+ positionals.push(token);
+ }
+ }
+
+ return { flags, positionals };
+}
diff --git a/scripts/release-smoke.ts b/scripts/release-smoke.ts
index 3ca283c11a..960730a354 100644
--- a/scripts/release-smoke.ts
+++ b/scripts/release-smoke.ts
@@ -127,17 +127,17 @@ try {
);
assertContains(
nightlyReleaseMetadata,
- "version=9.9.9-nightly.20260413.321",
+ "version=9.9.10-nightly.20260413.321",
"Expected nightly metadata to contain the derived nightly version.",
);
assertContains(
nightlyReleaseMetadata,
- "tag=nightly-v9.9.9-nightly.20260413.321",
+ "tag=nightly-v9.9.10-nightly.20260413.321",
"Expected nightly metadata to contain the derived nightly tag.",
);
assertContains(
nightlyReleaseMetadata,
- "name=T3 Code Nightly 9.9.9-nightly.20260413.321 (abcdef123456)",
+ "name=T3 Code Nightly 9.9.10-nightly.20260413.321 (abcdef123456)",
"Expected nightly metadata to include the short commit SHA in the release name.",
);
diff --git a/scripts/resolve-nightly-release.test.ts b/scripts/resolve-nightly-release.test.ts
index 8a38143445..56358d6c14 100644
--- a/scripts/resolve-nightly-release.test.ts
+++ b/scripts/resolve-nightly-release.test.ts
@@ -3,6 +3,7 @@ import { assert, it } from "@effect/vitest";
import {
resolveNightlyBaseVersion,
resolveNightlyReleaseMetadata,
+ resolveNightlyTargetVersion,
} from "./resolve-nightly-release.ts";
it("strips prerelease and build metadata when deriving the nightly base version", () => {
@@ -11,14 +12,20 @@ it("strips prerelease and build metadata when deriving the nightly base version"
assert.equal(resolveNightlyBaseVersion("1.2.3-beta.4+build.9"), "1.2.3");
});
+it("bumps the patch version before deriving nightly prerelease versions", () => {
+ assert.equal(resolveNightlyTargetVersion("0.0.17"), "0.0.18");
+ assert.equal(resolveNightlyTargetVersion("9.9.9-smoke.0"), "9.9.10");
+ assert.equal(resolveNightlyTargetVersion("1.2.3-beta.4+build.9"), "1.2.4");
+});
+
it("derives nightly metadata including the short commit sha in the release name", () => {
assert.deepStrictEqual(
- resolveNightlyReleaseMetadata("9.9.9", "20260413", 321, "abcdef1234567890"),
+ resolveNightlyReleaseMetadata("9.9.10", "20260413", 321, "abcdef1234567890"),
{
- baseVersion: "9.9.9",
- version: "9.9.9-nightly.20260413.321",
- tag: "nightly-v9.9.9-nightly.20260413.321",
- name: "T3 Code Nightly 9.9.9-nightly.20260413.321 (abcdef123456)",
+ baseVersion: "9.9.10",
+ version: "9.9.10-nightly.20260413.321",
+ tag: "nightly-v9.9.10-nightly.20260413.321",
+ name: "T3 Code Nightly 9.9.10-nightly.20260413.321 (abcdef123456)",
shortSha: "abcdef123456",
},
);
diff --git a/scripts/resolve-nightly-release.ts b/scripts/resolve-nightly-release.ts
index 571baec8f4..4a92ef63ae 100644
--- a/scripts/resolve-nightly-release.ts
+++ b/scripts/resolve-nightly-release.ts
@@ -32,6 +32,17 @@ const decodeDesktopPackageJson = Schema.decodeUnknownEffect(
export const resolveNightlyBaseVersion = (version: string) => version.replace(/[-+].*$/, "");
+export const resolveNightlyTargetVersion = (version: string) => {
+ const stableCore = resolveNightlyBaseVersion(version);
+ const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(stableCore);
+ if (!match) {
+ throw new Error(`Invalid desktop package version '${version}'.`);
+ }
+
+ const [, major, minor, patch] = match;
+ return `${major}.${minor}.${Number(patch) + 1}`;
+};
+
export const resolveNightlyReleaseMetadata = (
baseVersion: string,
date: string,
@@ -59,7 +70,7 @@ const readDesktopBaseVersion = Effect.fn("readDesktopBaseVersion")(function* (
const packageJson = yield* fs
.readFileString(packageJsonPath)
.pipe(Effect.flatMap(decodeDesktopPackageJson));
- return resolveNightlyBaseVersion(packageJson.version);
+ return resolveNightlyTargetVersion(packageJson.version);
});
const writeOutput = Effect.fn("writeOutput")(function* (
diff --git a/scripts/update-release-package-versions.test.ts b/scripts/update-release-package-versions.test.ts
new file mode 100644
index 0000000000..9e31c7675b
--- /dev/null
+++ b/scripts/update-release-package-versions.test.ts
@@ -0,0 +1,71 @@
+import { describe, expect, it } from "vitest";
+
+import { parseArgs } from "./update-release-package-versions.ts";
+
+describe("parseArgs", () => {
+ it("parses version only", () => {
+ expect(parseArgs(["1.2.3"])).toEqual({
+ version: "1.2.3",
+ rootDir: undefined,
+ writeGithubOutput: false,
+ });
+ });
+
+ it("parses version with --root", () => {
+ expect(parseArgs(["1.2.3", "--root", "/path"])).toEqual({
+ version: "1.2.3",
+ rootDir: "/path",
+ writeGithubOutput: false,
+ });
+ });
+
+ it("parses version with --github-output", () => {
+ expect(parseArgs(["1.2.3", "--github-output"])).toEqual({
+ version: "1.2.3",
+ rootDir: undefined,
+ writeGithubOutput: true,
+ });
+ });
+
+ it("parses version with --root and --github-output", () => {
+ expect(parseArgs(["1.2.3", "--root", "/path", "--github-output"])).toEqual({
+ version: "1.2.3",
+ rootDir: "/path",
+ writeGithubOutput: true,
+ });
+ });
+
+ it("accepts flags before the version positional", () => {
+ expect(parseArgs(["--github-output", "--root", "/path", "1.2.3"])).toEqual({
+ version: "1.2.3",
+ rootDir: "/path",
+ writeGithubOutput: true,
+ });
+ });
+
+ it("throws on missing version", () => {
+ expect(() => parseArgs([])).toThrow("Usage:");
+ });
+
+ it("throws on duplicate version", () => {
+ expect(() => parseArgs(["1.2.3", "2.0.0"])).toThrow(
+ "Only one release version can be provided.",
+ );
+ });
+
+ it("throws on unknown flag", () => {
+ expect(() => parseArgs(["1.2.3", "--unknown"])).toThrow("Unknown argument: --unknown");
+ });
+
+ it("throws on --root without value", () => {
+ expect(() => parseArgs(["1.2.3", "--root"])).toThrow("Missing value for --root.");
+ });
+
+ it("does not consume version as --github-output value", () => {
+ expect(parseArgs(["--github-output", "1.2.3"])).toEqual({
+ version: "1.2.3",
+ rootDir: undefined,
+ writeGithubOutput: true,
+ });
+ });
+});
diff --git a/scripts/update-release-package-versions.ts b/scripts/update-release-package-versions.ts
index b860b85e8e..cefeef33ea 100644
--- a/scripts/update-release-package-versions.ts
+++ b/scripts/update-release-package-versions.ts
@@ -2,6 +2,8 @@ import { appendFileSync, readFileSync, writeFileSync } from "node:fs";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
+import { parseCliArgs } from "@t3tools/shared/cliArgs";
+
export const releasePackageFiles = [
"apps/server/package.json",
"apps/desktop/package.json",
@@ -40,52 +42,37 @@ export function updateReleasePackageVersions(
return { changed };
}
-function parseArgs(argv: ReadonlyArray): {
+export function parseArgs(argv: ReadonlyArray): {
version: string;
rootDir: string | undefined;
writeGithubOutput: boolean;
} {
- let version: string | undefined;
- let rootDir: string | undefined;
- let writeGithubOutput = false;
+ const { flags, positionals } = parseCliArgs(argv, { booleanFlags: ["github-output"] });
- for (let index = 0; index < argv.length; index += 1) {
- const argument = argv[index];
- if (argument === undefined) {
- continue;
- }
-
- if (argument === "--github-output") {
- writeGithubOutput = true;
- continue;
- }
-
- if (argument === "--root") {
- rootDir = argv[index + 1];
- if (!rootDir) {
- throw new Error("Missing value for --root.");
- }
- index += 1;
- continue;
- }
-
- if (argument.startsWith("--")) {
- throw new Error(`Unknown argument: ${argument}`);
- }
-
- if (version !== undefined) {
- throw new Error("Only one release version can be provided.");
- }
- version = argument;
+ const unknownFlags = Object.keys(flags).filter((k) => k !== "github-output" && k !== "root");
+ if (unknownFlags.length > 0) {
+ throw new Error(`Unknown argument: --${unknownFlags[0]}`);
}
- if (!version) {
+ if ("root" in flags && flags.root === null) {
+ throw new Error("Missing value for --root.");
+ }
+
+ if (positionals.length > 1) {
+ throw new Error("Only one release version can be provided.");
+ }
+
+ if (positionals.length !== 1 || !positionals[0]) {
throw new Error(
"Usage: node scripts/update-release-package-versions.ts [--root ] [--github-output]",
);
}
- return { version, rootDir, writeGithubOutput };
+ return {
+ version: positionals[0],
+ rootDir: flags.root ?? undefined,
+ writeGithubOutput: "github-output" in flags,
+ };
}
const isMain =