We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dccb7b7 commit 107c528Copy full SHA for 107c528
1 file changed
src/lib/initialization.ts
@@ -9,10 +9,14 @@ import { getGitHubUser } from "~/services/github/get-user/service"
9
import { getModels } from "../services/copilot/get-models/service"
10
import { getGitHubToken } from "../services/github/get-token/service"
11
12
-// Extract to individual functions for each initialization step
13
async function initializeAppDirectory(): Promise<void> {
14
await fs.mkdir(PATHS.APP_DIR, { recursive: true })
15
- await fs.writeFile(PATHS.GITHUB_TOKEN_PATH, "", { flag: "a" })
+ try {
+ await fs.access(PATHS.GITHUB_TOKEN_PATH, fs.constants.W_OK)
16
+ } catch {
17
+ await fs.writeFile(PATHS.GITHUB_TOKEN_PATH, "")
18
+ await fs.chmod(PATHS.GITHUB_TOKEN_PATH, 0o600)
19
+ }
20
}
21
22
async function initializeGithubAuthentication(): Promise<void> {
0 commit comments