authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 15:54:59-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 15:54:59-07:00
log0671e34279d42faf69fccfd46ceae305ccfa7c6d
treee68a97cccbbae8b45dee704f2c47b1d2c6020ec0
parentd0f855bfa91b1d961a17a02ec3e383f9671caba1
signature Signed by PGP key B5690EEEBB952194

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


13 files changed, 16 insertions(+), 93 deletions(-)

apps/web/src/sourceControlPresentation.ts-2
......@@ -3,8 +3,6 @@ import type { ElementType } from "react";
33import type { SourceControlProviderInfo, SourceControlProviderKind } from "@t3tools/contracts";
44export {
55 DEFAULT_CHANGE_REQUEST_TERMINOLOGY,
6 formatChangeRequestAction,
7 formatCreateChangeRequestPhrase,
86 getChangeRequestTerminology,
97 resolveChangeRequestPresentation,
108 type ChangeRequestPresentation,
packages/shared/src/Net.ts+1
......@@ -63,6 +63,7 @@ export class NetService extends Context.Service<NetService, NetServiceShape>()(
6363 "@t3tools/shared/Net/NetService",
6464) {}
6565
66/** @public Service construction is part of the canonical Effect module API. */
6667export const make = () => {
6768 /**
6869 * 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 {
4343 >;
4444}
4545
46export function buildAgentAwarenessDeepLink(input: {
46function buildAgentAwarenessDeepLink(input: {
4747 readonly environmentId: EnvironmentId;
4848 readonly threadId: ThreadId;
4949}): string {
packages/shared/src/composerTrigger.ts-12
......@@ -115,18 +115,6 @@ export function detectComposerTrigger(
115115 };
116116}
117117
118export 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
130118export function replaceTextRange(
131119 text: string,
132120 rangeStart: number,
packages/shared/src/httpReadiness.ts+1-1
......@@ -5,7 +5,7 @@ import * as Ref from "effect/Ref";
55import * as Schedule from "effect/Schedule";
66import { HttpClient, HttpClientRequest } from "effect/unstable/http";
77
8export const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1_000;
8const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1_000;
99
1010/**
1111 * Normalizes an arbitrary readiness probe failure into a plain, structured value
packages/shared/src/model.ts+2-7
......@@ -35,7 +35,7 @@ function getRawSelectionValueById(
3535 return selection?.value;
3636}
3737
38export function getProviderOptionSelectionValue(
38function getProviderOptionSelectionValue(
3939 selections: ReadonlyArray<ProviderOptionSelection> | null | undefined,
4040 id: string,
4141): string | boolean | undefined {
......@@ -298,11 +298,6 @@ export function readCustomModelEntries(value: unknown): CustomModelDefinition[]
298298 return entries;
299299}
300300
301/** Slugs of a `customModels` setting, in stored order. */
302export function readCustomModelSlugs(value: unknown): string[] {
303 return readCustomModelEntries(value).map((entry) => entry.slug);
304}
305
306301/**
307302 * Write a definition back to the compact stored shape: a bare slug when it
308303 * carries nothing custom, otherwise an entry with only the set fields.
......@@ -361,7 +356,7 @@ export function resolveSelectableModel(
361356}
362357
363358/** Trim a string, returning null for empty/missing values. */
364export function trimOrNull<T extends string>(value: T | null | undefined): T | null {
359function trimOrNull<T extends string>(value: T | null | undefined): T | null {
365360 if (typeof value !== "string") return null;
366361 const trimmed = value.trim() as T;
367362 return trimmed || null;
packages/shared/src/observability.ts+1-1
......@@ -303,7 +303,7 @@ export function truncateTraceAttributes(attributes: TraceAttributes): TraceAttri
303303 return truncated ?? attributes;
304304}
305305
306export function spanToTraceRecord(span: SerializableSpan): EffectTraceRecord {
306function spanToTraceRecord(span: SerializableSpan): EffectTraceRecord {
307307 const status = span.status as Extract<Tracer.SpanStatus, { _tag: "Ended" }>;
308308 const parentSpanId = Option.getOrUndefined(span.parent)?.spanId;
309309
packages/shared/src/orchestrationTiming.ts+1-1
......@@ -28,7 +28,7 @@ export function formatDuration(durationMs: number): string {
2828 return parts.join(" ");
2929}
3030
31export function isLatestTurnSettled(
31function isLatestTurnSettled(
3232 latestTurn: LatestTurnTiming | null,
3333 session: SessionActivityState | null,
3434): boolean {
packages/shared/src/relayClient.ts+1-1
......@@ -20,7 +20,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
2020import { HostProcessArchitecture, HostProcessPlatform } from "./hostProcess.ts";
2121
2222export const CLOUDFLARED_VERSION = "2026.5.2";
23export const CLOUDFLARED_PATH_ENV_NAME = "T3CODE_CLOUDFLARED_PATH";
23const CLOUDFLARED_PATH_ENV_NAME = "T3CODE_CLOUDFLARED_PATH";
2424
2525export type RelayClientExecutableSource = "override" | "managed" | "path";
2626
packages/shared/src/schemaJson.ts+2-2
......@@ -199,12 +199,12 @@ const parseLenientJsonGetter = SchemaGetter.onSome((input: string) => {
199199 * strips trailing commas and JS-style comments before parsing.
200200 * Encoding produces strict JSON via `JSON.stringify`.
201201 */
202export const fromLenientJsonString = new SchemaTransformation.Transformation(
202const fromLenientJsonString = new SchemaTransformation.Transformation(
203203 parseLenientJsonGetter,
204204 SchemaGetter.stringifyJson(),
205205);
206206
207export const prettyJsonString = SchemaGetter.parseJson<string>().compose(
207const prettyJsonString = SchemaGetter.parseJson<string>().compose(
208208 SchemaGetter.stringifyJson({ space: 2 }),
209209);
210210
packages/shared/src/schemaYaml.ts+4-52
......@@ -32,32 +32,8 @@ function formatYamlParseError(error: unknown): string {
3232 return `Invalid YAML (code=${error.code}${location}).`;
3333}
3434
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 */
58export function parseYaml<E extends string>(
59 options?: YamlParseOptions,
60): SchemaGetter.Getter<unknown, E> {
35/** Parses YAML during decoding, reporting parse failures as InvalidValue issues. */
36function parseYaml<E extends string>(options?: YamlParseOptions): SchemaGetter.Getter<unknown, E> {
6137 return SchemaGetter.transformOrFail((input: E) =>
6238 Effect.try({
6339 try: () => parseYamlString(input, options) as unknown,
......@@ -66,32 +42,8 @@ export function parseYaml<E extends string>(
6642 );
6743}
6844
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 */
92export function stringifyYaml(
93 options?: YamlStringifyOptions,
94): SchemaGetter.Getter<string, unknown> {
45/** Serializes YAML during encoding, reporting stringify failures as InvalidValue issues. */
46function stringifyYaml(options?: YamlStringifyOptions): SchemaGetter.Getter<string, unknown> {
9547 return SchemaGetter.transformOrFail((input: unknown) =>
9648 Effect.try({
9749 try: () => stringifyYamlValue(input, options),
packages/shared/src/sourceControl.ts+1-12
......@@ -92,23 +92,12 @@ export function resolveChangeRequestPresentation(
9292 }
9393}
9494
95export function resolveChangeRequestPresentationForKind(
95function resolveChangeRequestPresentationForKind(
9696 kind: SourceControlProviderKind,
9797): ChangeRequestPresentation {
9898 return resolveChangeRequestPresentation({ kind, name: "", baseUrl: "" });
9999}
100100
101export function formatChangeRequestAction(
102 verb: "View" | "Create",
103 presentation: ChangeRequestPresentation,
104): string {
105 return `${verb} ${presentation.shortName}`;
106}
107
108export function formatCreateChangeRequestPhrase(presentation: ChangeRequestPresentation): string {
109 return `create ${presentation.shortName}`;
110}
111
112101export function getChangeRequestTerminology(
113102 provider: SourceControlProviderInfo | null | undefined,
114103): ChangeRequestTerminology {
packages/shared/src/usageLimits.ts+1-1
......@@ -161,7 +161,7 @@ export function limitsNotice(limits: ServerProviderUsageLimits): string | null {
161161 return limits.windows.length === 0 ? "No limits reported." : null;
162162}
163163
164export function resetMillis(window: ServerProviderUsageWindow): number | null {
164function resetMillis(window: ServerProviderUsageWindow): number | null {
165165 if (window.resetsAt === undefined) return null;
166166 const at = Date.parse(window.resetsAt);
167167 return Number.isFinite(at) ? at : null;