Skip to content

Commit e5b3955

Browse files
sanchitrkclaude
andcommitted
chore: adopt TypeScript 6 + tsgo hybrid toolchain
Pairs typescript@6 (the compiler vp pack drives through its classic API) with @typescript/native, a pinned TS 7 that effect-tsgo patches for Effect diagnostics, then moves the workspace to NodeNext with explicit .ts imports and erasableSyntaxOnly. Removes the deprecated pre-Effect harness loop and its now-unused dependencies. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 66a99d9 commit e5b3955

178 files changed

Lines changed: 2429 additions & 4965 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.vscode/settings.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"js/ts.tsdk.path": "./node_modules/@typescript/native/lib",
3+
"js/ts.tsdk.promptToUseWorkspaceVersion": true,
4+
"js/ts.experimental.useTsgo": true
5+
}

‎package.json‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
],
1818
"type": "module",
1919
"scripts": {
20+
"prepare": "node scripts/clean-tsgo-backups.mjs && effect-tsgo patch --typescript --oxlint --typescript-package @typescript/native",
2021
"lint": "vp lint",
2122
"check": "vp check",
2223
"check:packages": "vp run -r check",
2324
"test": "vp test",
2425
"test:packages": "vp run -r test",
25-
"typecheck": "vp check --no-fmt",
26+
"typecheck": "vp run -r --concurrency-limit 2 typecheck",
2627
"build": "vp run -r build",
2728
"build:packages": "vp run -r build",
2829
"bump:aikit": "pnpm --filter @codeworksh/aikit run bump",
@@ -31,9 +32,11 @@
3132
"release:aikit:dry": "pnpm --filter @codeworksh/aikit run release:dry"
3233
},
3334
"devDependencies": {
34-
"@types/node": "^26.1.2",
35-
"typescript": "^7.0.2",
36-
"vite-plus": "0.2.7"
35+
"@effect/tsgo": "catalog:",
36+
"@types/node": "catalog:",
37+
"@typescript/native": "catalog:",
38+
"typescript": "catalog:",
39+
"vite-plus": "catalog:"
3740
},
3841
"packageManager": "pnpm@11.5.2"
3942
}

‎packages/aikit/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"release:dev": "node ../../scripts/publish.js aikit --dev",
6060
"release:dry": "node ../../scripts/publish.js aikit --dry-run",
6161
"test": "vp test --exclude \"test/e2e/**\"",
62-
"test:e2e": "vp test"
62+
"test:e2e": "vp test",
63+
"typecheck": "node ../../scripts/tsgo.mjs --noEmit"
6364
},
6465
"dependencies": {
6566
"@ai-sdk/anthropic": "^3.0.79",

‎packages/aikit/src/cli.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import pkg from "../package.json" with { type: "json" };
33
import yargs from "yargs";
44
import { hideBin } from "yargs/helpers";
5-
import { ModelgenCommand } from "./cli/modelgen";
6-
import { OAuthCommand } from "./cli/oauth";
5+
import { ModelgenCommand } from "./cli/modelgen.ts";
6+
import { OAuthCommand } from "./cli/oauth.ts";
77

88
const cli = yargs(hideBin(process.argv))
99
.scriptName("aikit")

‎packages/aikit/src/cli/modelgen.ts‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { Filesystem, lazy } from "@codeworksh/utils";
1+
import { Filesystem } from "@codeworksh/utils";
2+
import { lazy } from "@codeworksh/utils";
23
import { resolve } from "node:path";
34
import { mapValues, pickBy, pipe } from "remeda";
45
import type { CommandModule } from "yargs";
5-
import { DEFAULT_AI_SDK_FALLBACK, isAISDKPackage, protocolForPackage } from "../llm/registry";
6-
import { ModelCatalog } from "../model/catalog";
7-
import { Model } from "../model/model";
6+
import { DEFAULT_AI_SDK_FALLBACK, isAISDKPackage, protocolForPackage } from "../llm/registry.ts";
7+
import * as ModelCatalog from "../model/catalog.ts";
8+
import * as Model from "../model/model.ts";
89

910
const DEFAULT_PROVIDER_BASE_URLS: Partial<Record<Model.KnownProviderEnum, string>> = {
1011
[Model.KnownProviderEnum.anthropic]: "https://api.anthropic.com/v1",
@@ -270,7 +271,7 @@ export function openAICodexBuiltInModels(): Record<string, Model.Info> {
270271
return models;
271272
}
272273

273-
export async function generateModels(args: { path?: string } = {}): Promise<string> {
274+
export async function generateModels(args: { path?: string | undefined } = {}): Promise<string> {
274275
const path = resolve(args.path ?? ModelCatalog.path());
275276
const modelsDev = await loadBuiltInFromModelsDev();
276277
const customCodexModels = openAICodexBuiltInModels();
@@ -282,7 +283,7 @@ export async function generateModels(args: { path?: string } = {}): Promise<stri
282283

283284
//
284285
// CLI entry
285-
export const ModelgenCommand: CommandModule<object, { path?: string }> = {
286+
export const ModelgenCommand: CommandModule<object, { path?: string | undefined }> = {
286287
command: "modelgen [path]",
287288
describe: "generate models.gen.json",
288289
builder: (yargs) =>

‎packages/aikit/src/cli/oauth.ts‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ import {
44
OpenAICodexOAuthClient,
55
type OpenAICodexOAuthCredentials,
66
openAICodexHeaders,
7-
} from "../oauth/openai/codex";
7+
} from "../oauth/openai/codex.ts";
88

9+
// `?: T | undefined` rather than plain `?: T`: yargs hands these through as explicit `undefined`,
10+
// which a bare optional property no longer accepts under `exactOptionalPropertyTypes`.
911
type AuthArgs = {
10-
openaiCodex?: boolean;
11-
authFile?: string;
12-
browser?: boolean;
13-
manual?: boolean;
14-
status?: boolean;
15-
refresh?: boolean;
16-
logout?: boolean;
17-
json?: boolean;
18-
printHeaders?: boolean;
19-
originator?: string;
12+
openaiCodex?: boolean | undefined;
13+
authFile?: string | undefined;
14+
browser?: boolean | undefined;
15+
manual?: boolean | undefined;
16+
status?: boolean | undefined;
17+
refresh?: boolean | undefined;
18+
logout?: boolean | undefined;
19+
json?: boolean | undefined;
20+
printHeaders?: boolean | undefined;
21+
originator?: string | undefined;
2022
};
2123

2224
async function promptLine(message: string): Promise<string> {
@@ -51,7 +53,7 @@ async function openBrowser(url: string): Promise<void> {
5153

5254
function printCredentials(
5355
credentials: OpenAICodexOAuthCredentials,
54-
options: { json?: boolean; printHeaders?: boolean },
56+
options: { json?: boolean | undefined; printHeaders?: boolean | undefined },
5557
) {
5658
if (options.json) {
5759
console.log(
@@ -80,7 +82,9 @@ function printCredentials(
8082
}
8183

8284
async function runOpenAICodexAuth(args: AuthArgs): Promise<void> {
83-
const storage = new JsonOpenAICodexAuthStorage({ path: args.authFile });
85+
const storage = new JsonOpenAICodexAuthStorage({
86+
...(args.authFile !== undefined && { path: args.authFile }),
87+
});
8488
const client = new OpenAICodexOAuthClient({ storage });
8589

8690
if (args.logout) {
@@ -113,7 +117,11 @@ async function runOpenAICodexAuth(args: AuthArgs): Promise<void> {
113117
}
114118

115119
const credentials = await client.login({
116-
originator: args.originator,
120+
...(args.originator !== undefined && { originator: args.originator }),
121+
...(args.manual && {
122+
onManualCodeInput: async () =>
123+
promptLine("Paste the redirect URL or authorization code, or wait for browser callback:"),
124+
}),
117125
onAuth: (info) => {
118126
console.log(info.instructions ?? "Complete OpenAI Codex authentication in your browser.");
119127
console.log(info.url);
@@ -124,9 +132,6 @@ async function runOpenAICodexAuth(args: AuthArgs): Promise<void> {
124132
}
125133
},
126134
onPrompt: async (prompt) => promptLine(prompt.message),
127-
onManualCodeInput: args.manual
128-
? async () => promptLine("Paste the redirect URL or authorization code, or wait for browser callback:")
129-
: undefined,
130135
});
131136

132137
console.log(`Saved OpenAI Codex credentials to ${storage.path}`);

0 commit comments

Comments
 (0)