Skip to content

Commit 9dd94de

Browse files
committed
chore(dead-exports): purge 222 dead exports, add CI guard (CL-6797)
Triage ts-prune report; allowlist 218 deliberate-public-surface exports in scripts/dead-export-allowlist.txt with reasons (CL-6815 lanes preserved). Delete 222 consumer-less exports including 4 fully-dead barrel files (net -566 lines across 51 files). Wire scripts/check-dead-exports.ts into package.json check script and CI dead-exports job.
1 parent b509ed3 commit 9dd94de

54 files changed

Lines changed: 251 additions & 601 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
- name: Typecheck
5050
run: bun run typecheck
5151

52+
- name: Dead exports
53+
run: bun run check:dead-exports
54+
5255
# Build runs beside the suite instead of before it: tests import ./src
5356
# directly and never read ./dist, so serializing build ahead of test put
5457
# build time on the critical path for no dependency reason.

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bun run check
4444
```
4545

4646
`bun run check` is the single pre-PR gate: it runs `lint`, `typecheck`,
47-
`build`, and `check:projects-dir-guard` — which runs the `test` suite under
47+
`check:dead-exports`, `build`, and `check:projects-dir-guard` — which runs the `test` suite under
4848
the projects-dir sandbox guard — in that order, matching CI.
4949

5050
Run the full suite before declaring any task complete. Do not substitute individual targets. If a failure is pre-existing and unrelated to your change, say so explicitly.

bun.lock

Lines changed: 102 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"test:parallel": "bun scripts/test-parallel.ts",
3838
"lint": "oxfmt --check . && oxlint",
3939
"check:projects-dir-guard": "bun scripts/guard-real-projects-dir.ts",
40-
"check": "bun run lint && bun run typecheck && bun run build && bun run check:projects-dir-guard",
40+
"check:dead-exports": "bun scripts/check-dead-exports.ts",
41+
"check": "bun run lint && bun run typecheck && bun run check:dead-exports && bun run build && bun run check:projects-dir-guard",
4142
"start": "bun run build && bun ./dist/index.js",
4243
"eval:capability": "bun scripts/eval-capability.ts",
4344
"eval:public-swe-one": "bun scripts/eval-public-swe-one.ts",
@@ -111,6 +112,7 @@
111112
"@types/bun": "1.3.9",
112113
"oxfmt": "^0.67.0",
113114
"oxlint": "^1.82.0",
115+
"ts-prune": "0.10.3",
114116
"typescript": "5.9.3",
115117
"typescript-language-server": "^4.3.4",
116118
"ws": "^8.21.0"

packages/first-class-providers/src/index.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,10 @@ export {
22
FIRST_CLASS_PROVIDERS,
33
OPENAI_API_BASE_URL,
44
OPENAI_API_MAX_COMPLETION_TOKENS_MODELS,
5-
connectListProviders,
65
firstClassPathAsProvider,
76
firstClassProviderById,
87
} from "./providers.js";
98
export type {
10-
FirstClassAuthKind,
11-
FirstClassBillingProduct,
129
FirstClassOAuthProvider,
1310
FirstClassProviderDef,
14-
FirstClassProviderPath,
1511
} from "./types.js";
16-
17-
// Re-export Go package surface so hosts can depend on one entry for connect.
18-
export {
19-
OPENCODE_GO_ANTHROPIC_BASE_URL,
20-
OPENCODE_GO_AUTH_HINT,
21-
OPENCODE_GO_BASE_URL,
22-
OPENCODE_GO_DEFAULT_MODEL,
23-
OPENCODE_GO_DISPLAY_NAME,
24-
OPENCODE_GO_MODEL_IDS,
25-
OPENCODE_GO_MODELS,
26-
OPENCODE_GO_PROVIDER_ID,
27-
buildGoCatalogEntry,
28-
fetchGoUsage,
29-
formatGoUsage,
30-
isKnownGoModel,
31-
protocolForGoModel,
32-
resolveGoEndpoint,
33-
validateGoApiKey,
34-
type GoCatalogEntry,
35-
type GoEndpoint,
36-
type GoModel,
37-
type GoProtocol,
38-
type GoUsage,
39-
} from "../../opencode-go/src/index.js";

packages/opencode-go/src/catalog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "./models.js";
1313

1414
/** Host-agnostic catalog projection for connect + model pickers. */
15-
export interface GoCatalogEntry {
15+
interface GoCatalogEntry {
1616
name: typeof OPENCODE_GO_PROVIDER_ID;
1717
displayName: typeof OPENCODE_GO_DISPLAY_NAME;
1818
baseURL: typeof OPENCODE_GO_BASE_URL;

packages/opencode-go/src/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const OPENCODE_GO_BASE_URL = "https://opencode.ai/zen/go/v1";
1414
export const OPENCODE_GO_ANTHROPIC_BASE_URL = "https://opencode.ai/zen/go";
1515

1616
export const OPENCODE_GO_USAGE_PATH = "/usage";
17-
export const OPENCODE_GO_MODELS_PATH = "/models";
1817

1918
export const OPENCODE_GO_AUTH_HINT =
2019
"Paste your OpenCode Go API key from https://opencode.ai/auth";

packages/opencode-go/src/endpoint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
} from "./constants.js";
55
import { type GoProtocol, protocolForGoModel } from "./models.js";
66

7-
export interface GoEndpoint {
7+
interface GoEndpoint {
88
protocol: GoProtocol;
99
/** Base URL for the selected protocol's adapter. */
1010
baseURL: string;

packages/opencode-go/src/index.ts

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,23 @@
11
export {
2-
OPENCODE_GO_ANTHROPIC_BASE_URL,
3-
OPENCODE_GO_AUTH_HINT,
42
OPENCODE_GO_BASE_URL,
53
OPENCODE_GO_DISPLAY_NAME,
6-
OPENCODE_GO_MODELS_PATH,
74
OPENCODE_GO_PROVIDER_ID,
8-
OPENCODE_GO_USAGE_PATH,
95
} from "./constants.js";
106

117
export {
128
OPENCODE_GO_DEFAULT_MODEL,
139
OPENCODE_GO_MODEL_IDS,
14-
OPENCODE_GO_MODELS,
1510
isKnownGoModel,
1611
protocolForGoModel,
17-
type GoModel,
18-
type GoModelId,
19-
type GoProtocol,
2012
} from "./models.js";
2113

22-
export { resolveGoEndpoint, type GoEndpoint } from "./endpoint.js";
23-
export { validateGoApiKey, type GoApiKeyValidation } from "./auth.js";
24-
export {
25-
fetchGoUsage,
26-
formatGoUsage,
27-
type GoFetch,
28-
type GoUsage,
29-
type GoUsageWindow,
30-
} from "./usage.js";
31-
export { buildGoCatalogEntry, type GoCatalogEntry } from "./catalog.js";
14+
export { resolveGoEndpoint } from "./endpoint.js";
15+
export { validateGoApiKey } from "./auth.js";
16+
export { fetchGoUsage, formatGoUsage } from "./usage.js";
17+
export { buildGoCatalogEntry } from "./catalog.js";
3218
export {
3319
isOpenCodeGoProvider,
3420
isOpenCodeGoProviderId,
3521
isOpenCodeGoURL,
3622
} from "./identity.js";
37-
export {
38-
parseGoAPIError,
39-
type GoErrorCategory,
40-
type GoErrorKind,
41-
type ParsedGoAPIError,
42-
} from "./errors.js";
23+
export { parseGoAPIError } from "./errors.js";

packages/opencode-go/src/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
export type GoProtocol = "chat-completions" | "responses" | "messages";
77

8-
export interface GoModel {
8+
interface GoModel {
99
id: string;
1010
name: string;
1111
protocol: GoProtocol;

0 commit comments

Comments
 (0)