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

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-09-05 15:54:59 -07:00
1 parent d0f855bfa9
commit 0671e34279
13 files changed
+16 -93

No files matched your search

@@ -3,8 +3,6 @@ import type { ElementType } from "react";
import type { SourceControlProviderInfo, SourceControlProviderKind } from "@t3tools/contracts";
export {
DEFAULT_CHANGE_REQUEST_TERMINOLOGY,
formatChangeRequestAction,
formatCreateChangeRequestPhrase,
getChangeRequestTerminology,
resolveChangeRequestPresentation,
type ChangeRequestPresentation,
+1
View File
@@ -63,6 +63,7 @@ export class NetService extends Context.Service<NetService, NetServiceShape>()(
"@t3tools/shared/Net/NetService",
) {}
/** @public Service construction is part of the canonical Effect module API. */
export const make = () => {
/**
* Returns true when a TCP server can bind to {host, port}.
+1 -1
View File
@@ -43,7 +43,7 @@ export interface ProjectThreadAwarenessInput {
>;
}
export function buildAgentAwarenessDeepLink(input: {
function buildAgentAwarenessDeepLink(input: {
readonly environmentId: EnvironmentId;
readonly threadId: ThreadId;
}): string {
-12
View File
@@ -115,18 +115,6 @@ export function detectComposerTrigger(
};
}
export function parseStandaloneComposerSlashCommand(
text: string,
): Exclude<ComposerSlashCommand, "model"> | null {
const match = /^\/(plan|default)\s*$/i.exec(text.trim());
if (!match) {
return null;
}
const command = match[1]?.toLowerCase();
if (command === "plan") return "plan";
return "default";
}
export function replaceTextRange(
text: string,
rangeStart: number,
+1 -1
View File
@@ -5,7 +5,7 @@ import * as Ref from "effect/Ref";
import * as Schedule from "effect/Schedule";
import { HttpClient, HttpClientRequest } from "effect/unstable/http";
export const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1_000;
const DEFAULT_HTTP_READY_PROBE_TIMEOUT_MS = 1_000;
/**
* Normalizes an arbitrary readiness probe failure into a plain, structured value
+2 -7
View File
@@ -35,7 +35,7 @@ function getRawSelectionValueById(
return selection?.value;
}
export function getProviderOptionSelectionValue(
function getProviderOptionSelectionValue(
selections: ReadonlyArray<ProviderOptionSelection> | null | undefined,
id: string,
): string | boolean | undefined {
@@ -298,11 +298,6 @@ export function readCustomModelEntries(value: unknown): CustomModelDefinition[]
return entries;
}
/** Slugs of a `customModels` setting, in stored order. */
export function readCustomModelSlugs(value: unknown): string[] {
return readCustomModelEntries(value).map((entry) => entry.slug);
}
/**
* Write a definition back to the compact stored shape: a bare slug when it
* carries nothing custom, otherwise an entry with only the set fields.
@@ -361,7 +356,7 @@ export function resolveSelectableModel(
}
/** Trim a string, returning null for empty/missing values. */
export function trimOrNull<T extends string>(value: T | null | undefined): T | null {
function trimOrNull<T extends string>(value: T | null | undefined): T | null {
if (typeof value !== "string") return null;
const trimmed = value.trim() as T;
return trimmed || null;
+1 -1
View File
@@ -303,7 +303,7 @@ export function truncateTraceAttributes(attributes: TraceAttributes): TraceAttri
return truncated ?? attributes;
}
export function spanToTraceRecord(span: SerializableSpan): EffectTraceRecord {
function spanToTraceRecord(span: SerializableSpan): EffectTraceRecord {
const status = span.status as Extract<Tracer.SpanStatus, { _tag: "Ended" }>;
const parentSpanId = Option.getOrUndefined(span.parent)?.spanId;
+1 -1
View File
@@ -28,7 +28,7 @@ export function formatDuration(durationMs: number): string {
return parts.join(" ");
}
export function isLatestTurnSettled(
function isLatestTurnSettled(
latestTurn: LatestTurnTiming | null,
session: SessionActivityState | null,
): boolean {
+1 -1
View File
@@ -20,7 +20,7 @@ import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
import { HostProcessArchitecture, HostProcessPlatform } from "./hostProcess.ts";
export const CLOUDFLARED_VERSION = "2026.5.2";
export const CLOUDFLARED_PATH_ENV_NAME = "T3CODE_CLOUDFLARED_PATH";
const CLOUDFLARED_PATH_ENV_NAME = "T3CODE_CLOUDFLARED_PATH";
export type RelayClientExecutableSource = "override" | "managed" | "path";
+2 -2
View File
@@ -199,12 +199,12 @@ const parseLenientJsonGetter = SchemaGetter.onSome((input: string) => {
* strips trailing commas and JS-style comments before parsing.
* Encoding produces strict JSON via `JSON.stringify`.
*/
export const fromLenientJsonString = new SchemaTransformation.Transformation(
const fromLenientJsonString = new SchemaTransformation.Transformation(
parseLenientJsonGetter,
SchemaGetter.stringifyJson(),
);
export const prettyJsonString = SchemaGetter.parseJson<string>().compose(
const prettyJsonString = SchemaGetter.parseJson<string>().compose(
SchemaGetter.stringifyJson({ space: 2 }),
);
+4 -52
View File
@@ -32,32 +32,8 @@ function formatYamlParseError(error: unknown): string {
return `Invalid YAML (code=${error.code}${location}).`;
}
/**
* Parses a YAML string into a value.
*
* **When to use**
*
* Use when you need a schema getter to parse a present encoded YAML string
* during decoding.
*
* **Details**
*
* Parse failures become `SchemaIssue.InvalidValue` values.
*
* **Example** (Parse YAML)
*
* ```ts
* import { parseYaml } from "@t3tools/shared/schemaYaml"
*
* const parse = parseYaml<string>()
* // Getter<unknown, string>
* ```
*
* @see {@link stringifyYaml} for the inverse operation
*/
export function parseYaml<E extends string>(
options?: YamlParseOptions,
): SchemaGetter.Getter<unknown, E> {
/** Parses YAML during decoding, reporting parse failures as InvalidValue issues. */
function parseYaml<E extends string>(options?: YamlParseOptions): SchemaGetter.Getter<unknown, E> {
return SchemaGetter.transformOrFail((input: E) =>
Effect.try({
try: () => parseYamlString(input, options) as unknown,
@@ -66,32 +42,8 @@ export function parseYaml<E extends string>(
);
}
/**
* Stringifies a present value as YAML.
*
* **When to use**
*
* Use when you need a schema getter to serialize a present decoded value to
* YAML text during encoding.
*
* **Details**
*
* Stringify failures become `SchemaIssue.InvalidValue` values.
*
* **Example** (Stringify YAML)
*
* ```ts
* import { stringifyYaml } from "@t3tools/shared/schemaYaml"
*
* const stringify = stringifyYaml()
* // Getter<string, unknown>
* ```
*
* @see {@link parseYaml} for the inverse operation
*/
export function stringifyYaml(
options?: YamlStringifyOptions,
): SchemaGetter.Getter<string, unknown> {
/** Serializes YAML during encoding, reporting stringify failures as InvalidValue issues. */
function stringifyYaml(options?: YamlStringifyOptions): SchemaGetter.Getter<string, unknown> {
return SchemaGetter.transformOrFail((input: unknown) =>
Effect.try({
try: () => stringifyYamlValue(input, options),
+1 -12
View File
@@ -92,23 +92,12 @@ export function resolveChangeRequestPresentation(
}
}
export function resolveChangeRequestPresentationForKind(
function resolveChangeRequestPresentationForKind(
kind: SourceControlProviderKind,
): ChangeRequestPresentation {
return resolveChangeRequestPresentation({ kind, name: "", baseUrl: "" });
}
export function formatChangeRequestAction(
verb: "View" | "Create",
presentation: ChangeRequestPresentation,
): string {
return `${verb} ${presentation.shortName}`;
}
export function formatCreateChangeRequestPhrase(presentation: ChangeRequestPresentation): string {
return `create ${presentation.shortName}`;
}
export function getChangeRequestTerminology(
provider: SourceControlProviderInfo | null | undefined,
): ChangeRequestTerminology {
+1 -1
View File
@@ -161,7 +161,7 @@ export function limitsNotice(limits: ServerProviderUsageLimits): string | null {
return limits.windows.length === 0 ? "No limits reported." : null;
}
export function resetMillis(window: ServerProviderUsageWindow): number | null {
function resetMillis(window: ServerProviderUsageWindow): number | null {
if (window.resetsAt === undefined) return null;
const at = Date.parse(window.resetsAt);
return Number.isFinite(at) ? at : null;