Skip to content

Commit 4185f24

Browse files
reapply: feat: provide auth header to attach command too
1 parent c226b81 commit 4185f24

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

packages/opencode/src/cli/cmd/tui/attach.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,21 @@ export const AttachCommand = cmd({
2424
handler: async (args) => {
2525
if (args.dir) process.chdir(args.dir)
2626

27-
/**
28-
* Reverted since the windows-check (github-action) is not passing anymore - needs investigation.
29-
*/
3027
// If server requires authentication, create a custom fetch that includes the auth header
31-
// const authHeader = getAuthorizationHeader()
32-
// const customFetch = authHeader
33-
// ? ((async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {
34-
// const request = new Request(input, init)
35-
// request.headers.set("Authorization", authHeader)
36-
// return fetch(request)
37-
// }) as typeof fetch)
38-
// : undefined
28+
const authHeader = getAuthorizationHeader()
29+
const customFetch = authHeader
30+
? ((async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {
31+
const request = new Request(input, init)
32+
request.headers.set("Authorization", authHeader)
33+
return fetch(request)
34+
}) as typeof fetch)
35+
: undefined
3936

4037
await tui({
4138
url: args.url,
4239
args: { sessionID: args.session },
4340
directory: args.dir ? process.cwd() : undefined,
44-
// fetch: customFetch,
41+
fetch: customFetch,
4542
})
4643
},
4744
})

0 commit comments

Comments
 (0)