forked from ProverCoderAI/docker-git
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu-helpers.ts
More file actions
43 lines (40 loc) · 1.31 KB
/
menu-helpers.ts
File metadata and controls
43 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import type { ProjectConfig } from "../core/domain.js"
export { defaultProjectsRoot, findSshPrivateKey, resolveAuthorizedKeysPath } from "./path-helpers.js"
export const isRepoUrlInput = (input: string): boolean => {
const trimmed = input.trim().toLowerCase()
return trimmed.startsWith("http://") ||
trimmed.startsWith("https://") ||
trimmed.startsWith("ssh://") ||
trimmed.startsWith("git@")
}
export const formatConnectionInfo = (
cwd: string,
config: ProjectConfig,
authorizedKeysPath: string,
authorizedKeysExists: boolean,
sshCommand: string
): string => {
const hostnameLabel = config.template.clonedOnHostname === undefined
? ""
: `\nCloned on device: ${config.template.clonedOnHostname}`
return `Project directory: ${cwd}
` +
`Container: ${config.template.containerName}
` +
`Service: ${config.template.serviceName}
` +
`SSH command: ${sshCommand}
` +
`Repo: ${config.template.repoUrl} (${config.template.repoRef})
` +
`Workspace: ${config.template.targetDir}
` +
`Authorized keys: ${authorizedKeysPath}${authorizedKeysExists ? "" : " (missing)"}
` +
`Env global: ${config.template.envGlobalPath}
` +
`Env project: ${config.template.envProjectPath}
` +
`Codex auth: ${config.template.codexAuthPath} -> ${config.template.codexHome}` +
hostnameLabel
}