@devries-cameron20 / t3code Mirror · read-only / commits / 0671e34279
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 09:00 UTC

refactor(shared): remove unused runtime helpers and exports (#10166)

Julius Marminge committed Sep 5, 2026 at 15:54 UTC 0671e34279d42faf69fccfd46ceae305ccfa7c6d
13 files changed +16 -93
apps/web/src/sourceControlPresentation.ts
-2
@@ -3,8 +3,6 @@ import type { ElementType } from "react";
3 import type { SourceControlProviderInfo, SourceControlProviderKind } from "@t3tools/contracts";
4 export {
5 DEFAULT_CHANGE_REQUEST_TERMINOLOGY,
6 - formatChangeRequestAction,
7 - formatCreateChangeRequestPhrase,
6 getChangeRequestTerminology,
7 resolveChangeRequestPresentation,
8 type ChangeRequestPresentation,
packages/shared/src/Net.ts
+1
@@ -63,6 +63,7 @@ export class NetService extends Context.Service<NetService, NetServiceShape>()(
63 "@t3tools/shared/Net/NetService",
64 ) {}
65
66 +/** @public Service construction is part of the canonical Effect module API. */
67 export const make = () => {
68 /**
69 * Returns true when a TCP server can bind to {host, port}.
packages/shared/src/agentAwareness.ts
+1 -1
@@ -43,7 +43,7 @@ export interface ProjectThreadAwarenessInput {
43 >;
44 }
45
46 -export function buildAgentAwarenessDeepLink(input: {
46 +function buildAgentAwarenessDeepLink(input: {
47 readonly environmentId: EnvironmentId;
48 readonly threadId: ThreadId;
49 }): string {
packages/shared/src/composerTrigger.ts
-12
@@ -115,18 +115,6 @@ export function detectComposerTrigger(
115 };
116 }
117
118 -export function parseStandaloneComposerSlashCommand(
119 - text: string,
120 -): Exclude<ComposerSlashCommand, "model"> | null {
121 - const match = /^\/(plan|default)\s*$/i.exec(text.trim());
122 - if (!match) {
123 - return null;
124 - }
125 - const command = match[1]?.toLowerCase();
126 - if (command === "plan") return "plan";
127 - return "default";
128 -}
129 -
118 export function replaceTextRange(
119 text: string,
120 rangeStart: number,
packages/shared/src/httpReadiness.ts
+1 -1
@@ -5,7 +5,7 @@ import * as Ref from "effect/Ref";
5 import * as Schedule from "effect/Schedule";
6 import { HttpClient, HttpClientRequest } from "effect/unstable/http";
7
8 -export const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1_000;
8 +const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1_000;
9
10 /**
11 * Normalizes an arbitrary readiness probe failure into a plain, structured value
packages/shared/src/model.ts
+2 -7
@@ -35,7 +35,7 @@ function getRawSelectionValueById(
35 return selection?.value;
36 }
37
38 -export function getProviderOptionSelectionValue(
38 +function getProviderOptionSelectionValue(
39 selections: ReadonlyArray<ProviderOptionSelection> | null | undefined,
40 id: string,
41 ): string | boolean | undefined {
@@ -298,11 +298,6 @@ export function readCustomModelEntries(value: unknown): CustomModelDefinition[]
298 return entries;
299 }
300
301 -/** Slugs of a `customModels` setting, in stored order. */
302 -export function readCustomModelSlugs(value: unknown): string[] {
303 - return readCustomModelEntries(value).map((entry) => entry.slug);
304 -}
305 -
301 /**
302 * Write a definition back to the compact stored shape: a bare slug when it
303 * carries nothing custom, otherwise an entry with only the set fields.
@@ -361,7 +356,7 @@ export function resolveSelectableModel(
356 }
357
358 /** Trim a string, returning null for empty/missing values. */
364 -export function trimOrNull<T extends string>(value: T | null | undefined): T | null {
359 +function trimOrNull<T extends string>(value: T | null | undefined): T | null {
360 if (typeof value !== "string") return null;
361 const trimmed = value.trim() as T;
362 return trimmed || null;
packages/shared/src/observability.ts
+1 -1
@@ -303,7 +303,7 @@ export function truncateTraceAttributes(attributes: TraceAttributes): TraceAttri
303 return truncated ?? attributes;
304 }
305
306 -export function spanToTraceRecord(span: SerializableSpan): EffectTraceRecord {
306 +function spanToTraceRecord(span: SerializableSpan): EffectTraceRecord {
307 const status = span.status as Extract<Tracer.SpanStatus, { _tag: "Ended" }>;
308 const parentSpanId = Option.getOrUndefined(span.parent)?.spanId;
309
packages/shared/src/orchestrationTiming.ts
+1 -1
@@ -28,7 +28,7 @@ export function formatDuration(durationMs: number): string {
28 return parts.join(" ");
29 }
30
31 -export function isLatestTurnSettled(
31 +function isLatestTurnSettled(
32 latestTurn: LatestTurnTiming | null,
33 session: SessionActivityState | null,
34 ): boolean {
packages/shared/src/relayClient.ts
+1 -1
@@ -20,7 +20,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
20 import { HostProcessArchitecture, HostProcessPlatform } from "./hostProcess.ts";
21
22 export const CLOUDFLARED_VERSION = "2026.5.2";
23 -export const CLOUDFLARED_PATH_ENV_NAME = "T3CODE_CLOUDFLARED_PATH";
23 +const CLOUDFLARED_PATH_ENV_NAME = "T3CODE_CLOUDFLARED_PATH";
24
25 export type RelayClientExecutableSource = "override" | "managed" | "path";
26
packages/shared/src/schemaJson.ts
+2 -2
@@ -199,12 +199,12 @@ const parseLenientJsonGetter = SchemaGetter.onSome((input: string) => {
199 * strips trailing commas and JS-style comments before parsing.
200 * Encoding produces strict JSON via `JSON.stringify`.
201 */
202 -export const fromLenientJsonString = new SchemaTransformation.Transformation(
202 +const fromLenientJsonString = new SchemaTransformation.Transformation(
203 parseLenientJsonGetter,
204 SchemaGetter.stringifyJson(),
205 );
206
207 -export const prettyJsonString = SchemaGetter.parseJson<string>().compose(
207 +const prettyJsonString = SchemaGetter.parseJson<string>().compose(
208 SchemaGetter.stringifyJson({ space: 2 }),
209 );
210
packages/shared/src/schemaYaml.ts
+4 -52
@@ -32,32 +32,8 @@ function formatYamlParseError(error: unknown): string {
32 return `Invalid YAML (code=${error.code}${location}).`;
33 }
34
35 -/**
36 - * Parses a YAML string into a value.
37 - *
38 - * **When to use**
39 - *
40 - * Use when you need a schema getter to parse a present encoded YAML string
41 - * during decoding.
42 - *
43 - * **Details**
44 - *
45 - * Parse failures become `SchemaIssue.InvalidValue` values.
46 - *
47 - * **Example** (Parse YAML)
48 - *
49 - * ```ts
50 - * import { parseYaml } from "@t3tools/shared/schemaYaml"
51 - *
52 - * const parse = parseYaml<string>()
53 - * // Getter<unknown, string>
54 - * ```
55 - *
56 - * @see {@link stringifyYaml} for the inverse operation
57 - */
58 -export function parseYaml<E extends string>(
59 - options?: YamlParseOptions,
60 -): SchemaGetter.Getter<unknown, E> {
35 +/** Parses YAML during decoding, reporting parse failures as InvalidValue issues. */
36 +function parseYaml<E extends string>(options?: YamlParseOptions): SchemaGetter.Getter<unknown, E> {
37 return SchemaGetter.transformOrFail((input: E) =>
38 Effect.try({
39 try: () => parseYamlString(input, options) as unknown,
@@ -66,32 +42,8 @@ export function parseYaml<E extends string>(
42 );
43 }
44
69 -/**
70 - * Stringifies a present value as YAML.
71 - *
72 - * **When to use**
73 - *
74 - * Use when you need a schema getter to serialize a present decoded value to
75 - * YAML text during encoding.
76 - *
77 - * **Details**
78 - *
79 - * Stringify failures become `SchemaIssue.InvalidValue` values.
80 - *
81 - * **Example** (Stringify YAML)
82 - *
83 - * ```ts
84 - * import { stringifyYaml } from "@t3tools/shared/schemaYaml"
85 - *
86 - * const stringify = stringifyYaml()
87 - * // Getter<string, unknown>
88 - * ```
89 - *
90 - * @see {@link parseYaml} for the inverse operation
91 - */
92 -export function stringifyYaml(
93 - options?: YamlStringifyOptions,
94 -): SchemaGetter.Getter<string, unknown> {
45 +/** Serializes YAML during encoding, reporting stringify failures as InvalidValue issues. */
46 +function stringifyYaml(options?: YamlStringifyOptions): SchemaGetter.Getter<string, unknown> {
47 return SchemaGetter.transformOrFail((input: unknown) =>
48 Effect.try({
49 try: () => stringifyYamlValue(input, options),
packages/shared/src/sourceControl.ts
+1 -12
@@ -92,23 +92,12 @@ export function resolveChangeRequestPresentation(
92 }
93 }
94
95 -export function resolveChangeRequestPresentationForKind(
95 +function resolveChangeRequestPresentationForKind(
96 kind: SourceControlProviderKind,
97 ): ChangeRequestPresentation {
98 return resolveChangeRequestPresentation({ kind, name: "", baseUrl: "" });
99 }
100
101 -export function formatChangeRequestAction(
102 - verb: "View" | "Create",
103 - presentation: ChangeRequestPresentation,
104 -): string {
105 - return `${verb} ${presentation.shortName}`;
106 -}
107 -
108 -export function formatCreateChangeRequestPhrase(presentation: ChangeRequestPresentation): string {
109 - return `create ${presentation.shortName}`;
110 -}
111 -
101 export function getChangeRequestTerminology(
102 provider: SourceControlProviderInfo | null | undefined,
103 ): ChangeRequestTerminology {
packages/shared/src/usageLimits.ts
+1 -1
@@ -161,7 +161,7 @@ export function limitsNotice(limits: ServerProviderUsageLimits): string | null {
161 return limits.windows.length === 0 ? "No limits reported." : null;
162 }
163
164 -export function resetMillis(window: ServerProviderUsageWindow): number | null {
164 +function resetMillis(window: ServerProviderUsageWindow): number | null {
165 if (window.resetsAt === undefined) return null;
166 const at = Date.parse(window.resetsAt);
167 return Number.isFinite(at) ? at : null;