Files
orcs-code/src/components/TeleportRepoMismatchDialog.tsx
Anandan 462a985d7e Remove embedded source map directives from tracked sources (#329)
Inline base64 source maps had been checked into tracked src files. This strips those comments from the repository without changing runtime behavior or adding ongoing guardrails, per the requested one-time cleanup scope.

Constraint: Keep this change limited to tracked source cleanup only
Rejected: Add CI/source verification guard | user requested one-time cleanup only
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If these directives reappear, fix the producing transform instead of reintroducing repo-side cleanup code
Tested: rg -n "sourceMappingURL" ., bun run smoke, bun run verify:privacy, bun run test:provider, npm run test:provider-recommendation
Not-tested: bun run typecheck (repository has many pre-existing unrelated failures)

Co-authored-by: anandh8x <test@example.com>
2026-04-04 21:19:27 +08:00

104 lines
3.4 KiB
TypeScript

import { c as _c } from "react-compiler-runtime";
import React, { useCallback, useState } from 'react';
import { Box, Text } from '../ink.js';
import { getDisplayPath } from '../utils/file.js';
import { removePathFromRepo, validateRepoAtPath } from '../utils/githubRepoPathMapping.js';
import { Select } from './CustomSelect/index.js';
import { Dialog } from './design-system/Dialog.js';
import { Spinner } from './Spinner.js';
type Props = {
targetRepo: string;
initialPaths: string[];
onSelectPath: (path: string) => void;
onCancel: () => void;
};
export function TeleportRepoMismatchDialog(t0) {
const $ = _c(18);
const {
targetRepo,
initialPaths,
onSelectPath,
onCancel
} = t0;
const [availablePaths, setAvailablePaths] = useState(initialPaths);
const [errorMessage, setErrorMessage] = useState(null);
const [validating, setValidating] = useState(false);
let t1;
if ($[0] !== availablePaths || $[1] !== onCancel || $[2] !== onSelectPath || $[3] !== targetRepo) {
t1 = async value => {
if (value === "cancel") {
onCancel();
return;
}
setValidating(true);
setErrorMessage(null);
const isValid = await validateRepoAtPath(value, targetRepo);
if (isValid) {
onSelectPath(value);
return;
}
removePathFromRepo(targetRepo, value);
const updatedPaths = availablePaths.filter(p => p !== value);
setAvailablePaths(updatedPaths);
setValidating(false);
setErrorMessage(`${getDisplayPath(value)} no longer contains the correct repository. Select another path.`);
};
$[0] = availablePaths;
$[1] = onCancel;
$[2] = onSelectPath;
$[3] = targetRepo;
$[4] = t1;
} else {
t1 = $[4];
}
const handleChange = t1;
let t2;
if ($[5] !== availablePaths) {
let t3;
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
t3 = {
label: "Cancel",
value: "cancel"
};
$[7] = t3;
} else {
t3 = $[7];
}
t2 = [...availablePaths.map(_temp), t3];
$[5] = availablePaths;
$[6] = t2;
} else {
t2 = $[6];
}
const options = t2;
let t3;
if ($[8] !== availablePaths.length || $[9] !== errorMessage || $[10] !== handleChange || $[11] !== options || $[12] !== targetRepo || $[13] !== validating) {
t3 = availablePaths.length > 0 ? <><Box flexDirection="column" gap={1}>{errorMessage && <Text color="error">{errorMessage}</Text>}<Text>Open Claude Code in <Text bold={true}>{targetRepo}</Text>:</Text></Box>{validating ? <Box><Spinner /><Text> Validating repository</Text></Box> : <Select options={options} onChange={value_0 => void handleChange(value_0)} />}</> : <Box flexDirection="column" gap={1}>{errorMessage && <Text color="error">{errorMessage}</Text>}<Text dimColor={true}>Run claude --teleport from a checkout of {targetRepo}</Text></Box>;
$[8] = availablePaths.length;
$[9] = errorMessage;
$[10] = handleChange;
$[11] = options;
$[12] = targetRepo;
$[13] = validating;
$[14] = t3;
} else {
t3 = $[14];
}
let t4;
if ($[15] !== onCancel || $[16] !== t3) {
t4 = <Dialog title="Teleport to Repo" onCancel={onCancel} color="background">{t3}</Dialog>;
$[15] = onCancel;
$[16] = t3;
$[17] = t4;
} else {
t4 = $[17];
}
return t4;
}
function _temp(path) {
return {
label: <Text>Use <Text bold={true}>{getDisplayPath(path)}</Text></Text>,
value: path
};
}