MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / updateGitRemoteToken

Function updateGitRemoteToken

services/cloud-agent-next/src/workspace.ts:900–931  ·  view source on GitHub ↗
(
  session: ExecutionSession,
  workspacePath: string,
  gitUrl: string,
  gitToken: string,
  platform?: ManagedGitPlatform
)

Source from the content-addressed store, hash-verified

898
899export async function updateGitAuthor(
900 session: ExecutionSession,
901 workspacePath: string,
902 gitAuthor: GitAuthorConfig
903): Promise<void> {
904 const nameResult = await timedExec(
905 session,
906 `git config user.name ${shellQuote(gitAuthor.name)}`,
907 'git.config.userName',
908 { cwd: workspacePath }
909 );
910 const emailResult = await timedExec(
911 session,
912 `git config user.email ${shellQuote(gitAuthor.email)}`,
913 'git.config.userEmail',
914 { cwd: workspacePath }
915 );
916 if (nameResult.exitCode !== 0 || emailResult.exitCode !== 0) {
917 throw new Error('Failed to configure git author identity');
918 }
919}
920
921export async function updateGitRemoteUrl(
922 session: ExecutionSession,
923 workspacePath: string,
924 gitUrl: string
925): Promise<void> {
926 let originUrl = gitUrl;
927 try {
928 const canonicalUrl = new URL(gitUrl);
929 canonicalUrl.username = '';
930 canonicalUrl.password = '';
931 originUrl = canonicalUrl.toString();
932 } catch {
933 // SCP-style remotes are already credential-free; leave them unchanged.
934 }

Callers 2

workspace.test.tsFile · 0.90
refreshGitRemoteTokenMethod · 0.85

Calls 6

gitCredentialUsernameFunction · 0.85
sanitizeGitUrlForLoggingFunction · 0.85
timedExecFunction · 0.85
infoMethod · 0.65
toStringMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected