MCPcopy Index your code
hub / github.com/codeaashu/claude-code / Web

Function Web

src/commands/remote-setup/remote-setup.tsx:82–183  ·  view source on GitHub ↗
({
  onDone
}: {
  onDone: LocalJSXCommandOnDone;
})

Source from the content-addressed store, hash-verified

80 name: 'uploading';
81};
82function Web({
83 onDone
84}: {
85 onDone: LocalJSXCommandOnDone;
86}) {
87 const [step, setStep] = useState<Step>({
88 name: 'checking'
89 });
90 useEffect(() => {
91 logEvent('tengu_remote_setup_started', {});
92 void checkLoginState().then(async result => {
93 switch (result.status) {
94 case 'not_signed_in':
95 logEvent('tengu_remote_setup_result', {
96 result: 'not_signed_in' as SafeString
97 });
98 onDone('Not signed in to Claude. Run /login first.');
99 return;
100 case 'gh_not_installed':
101 case 'gh_not_authenticated':
102 {
103 const url = `${getCodeWebUrl()}/onboarding?step=alt-auth`;
104 await openBrowser(url);
105 logEvent('tengu_remote_setup_result', {
106 result: result.status as SafeString
107 });
108 onDone(result.status === 'gh_not_installed' ? `GitHub CLI not found. Install it via https://cli.github.com/, then run \`gh auth login\`, or connect GitHub on the web: ${url}` : `GitHub CLI not authenticated. Run \`gh auth login\` and try again, or connect GitHub on the web: ${url}`);
109 return;
110 }
111 case 'has_gh_token':
112 setStep({
113 name: 'confirm',
114 token: result.token
115 });
116 }
117 });
118 // onDone is stable across renders; intentionally not in deps.
119 // eslint-disable-next-line react-hooks/exhaustive-deps
120 }, []);
121 const handleCancel = () => {
122 logEvent('tengu_remote_setup_result', {
123 result: 'cancelled' as SafeString
124 });
125 onDone();
126 };
127 const handleConfirm = async (token: RedactedGithubToken) => {
128 setStep({
129 name: 'uploading'
130 });
131 const result = await importGithubToken(token);
132 if (!result.ok) {
133 logEvent('tengu_remote_setup_result', {
134 result: 'import_failed' as SafeString,
135 error_kind: result.error.kind as SafeString
136 });
137 onDone(errorMessage(result.error, getCodeWebUrl()));
138 return;
139 }

Callers

nothing calls this directly

Calls 8

logEventFunction · 0.85
checkLoginStateFunction · 0.85
getCodeWebUrlFunction · 0.85
openBrowserFunction · 0.85
setStepFunction · 0.85
handleConfirmFunction · 0.85
handleCancelFunction · 0.70
onDoneFunction · 0.50

Tested by

no test coverage detected