Skip to content

Commit 260dfaa

Browse files
committed
feat(cli): add username option for basic auth in attach command
1 parent becf57e commit 260dfaa

19 files changed

Lines changed: 151 additions & 73 deletions

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export const AttachCommand = cmd({
3838
alias: ["p"],
3939
type: "string",
4040
describe: "basic auth password (defaults to OPENCODE_SERVER_PASSWORD)",
41+
})
42+
.option("username", {
43+
alias: ["u"],
44+
type: "string",
45+
describe: "basic auth username (defaults to OPENCODE_SERVER_USERNAME or 'opencode')",
4146
}),
4247
handler: async (args) => {
4348
const unguard = win32InstallCtrlCGuard()
@@ -63,7 +68,8 @@ export const AttachCommand = cmd({
6368
const headers = (() => {
6469
const password = args.password ?? process.env.OPENCODE_SERVER_PASSWORD
6570
if (!password) return undefined
66-
const auth = `Basic ${Buffer.from(`opencode:${password}`).toString("base64")}`
71+
const username = args.username ?? process.env.OPENCODE_SERVER_USERNAME ?? "opencode"
72+
const auth = `Basic ${Buffer.from(`${username}:${password}`).toString("base64")}`
6773
return { Authorization: auth }
6874
})()
6975
const config = await TuiConfig.get()

packages/web/src/content/docs/ar/cli.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ opencode attach http://10.20.30.40:4096
7878

7979
#### الرايات
8080

81-
| الراية | المختصر | الوصف |
82-
| ----------- | ------- | ----------------------------------- |
83-
| `--dir` | | دليل العمل الذي ستبدأ منه واجهة TUI |
84-
| `--session` | `-s` | معرّف الجلسة للمتابعة |
81+
| الراية | المختصر | الوصف |
82+
| ------------ | ------- | --------------------------------------------------------------------------------- |
83+
| `--dir` | | دليل العمل الذي ستبدأ منه واجهة TUI |
84+
| `--continue` | `-c` | متابعة آخر جلسة |
85+
| `--session` | `-s` | معرّف الجلسة للمتابعة |
86+
| `--fork` | | تفريع الجلسة عند المتابعة (استخدمه مع `--continue` أو `--session`) |
87+
| `--password` | `-p` | كلمة مرور المصادقة الأساسية (الافتراضي `OPENCODE_SERVER_PASSWORD`) |
88+
| `--username` | `-u` | اسم مستخدم المصادقة الأساسية (الافتراضي `OPENCODE_SERVER_USERNAME` أو `opencode`) |
8589

8690
---
8791

packages/web/src/content/docs/bs/cli.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ opencode attach http://10.20.30.40:4096
7878

7979
#### Opcije
8080

81-
| Opcija | Kratko | Opis |
82-
| ----------- | ------ | ------------------------------------ |
83-
| `--dir` | | Radni direktorij za pokretanje TUI-a |
84-
| `--session` | `-s` | ID sesije za nastavak |
81+
| Opcija | Kratko | Opis |
82+
| ------------ | ------ | --------------------------------------------------------------------------------------------- |
83+
| `--dir` | | Radni direktorij za pokretanje TUI-a |
84+
| `--continue` | `-c` | Nastavi posljednju sesiju |
85+
| `--session` | `-s` | ID sesije za nastavak |
86+
| `--fork` | | Forkuj sesiju prilikom nastavka (koristite sa `--continue` ili `--session`) |
87+
| `--password` | `-p` | Lozinka za osnovnu autentifikaciju (zadano: `OPENCODE_SERVER_PASSWORD`) |
88+
| `--username` | `-u` | Korisničko ime za osnovnu autentifikaciju (zadano: `OPENCODE_SERVER_USERNAME` ili `opencode`) |
8589

8690
---
8791

packages/web/src/content/docs/cli.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ opencode attach http://10.20.30.40:4096
7878

7979
#### Flags
8080

81-
| Flag | Short | Description |
82-
| ----------- | ----- | --------------------------------- |
83-
| `--dir` | | Working directory to start TUI in |
84-
| `--session` | `-s` | Session ID to continue |
81+
| Flag | Short | Description |
82+
| ------------ | ----- | -------------------------------------------------------------------------- |
83+
| `--dir` | | Working directory to start TUI in |
84+
| `--continue` | `-c` | Continue the last session |
85+
| `--session` | `-s` | Session ID to continue |
86+
| `--fork` | | Fork the session when continuing (use with `--continue` or `--session`) |
87+
| `--password` | `-p` | Basic auth password (defaults to `OPENCODE_SERVER_PASSWORD`) |
88+
| `--username` | `-u` | Basic auth username (defaults to `OPENCODE_SERVER_USERNAME` or `opencode`) |
8589

8690
---
8791

packages/web/src/content/docs/da/cli.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ opencode attach http://10.20.30.40:4096
7878

7979
#### Flag
8080

81-
| Flag | Kort | Beskrivelse |
82-
| ----------- | ---- | -------------------------------- |
83-
| `--dir` | | Arbejdsmappe til at starte TUI i |
84-
| `--session` | `-s` | Sessions-id for at fortsætte |
81+
| Flag | Kort | Beskrivelse |
82+
| ------------ | ---- | --------------------------------------------------------------------------------- |
83+
| `--dir` | | Arbejdsmappe til at starte TUI i |
84+
| `--continue` | `-c` | Fortsæt den seneste session |
85+
| `--session` | `-s` | Sessions-id for at fortsætte |
86+
| `--fork` | | Forgren sessionen ved fortsættelse (brug med `--continue` eller `--session`) |
87+
| `--password` | `-p` | Adgangskode til basic auth (standard: `OPENCODE_SERVER_PASSWORD`) |
88+
| `--username` | `-u` | Brugernavn til basic auth (standard: `OPENCODE_SERVER_USERNAME` eller `opencode`) |
8589

8690
---
8791

packages/web/src/content/docs/de/cli.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ opencode attach http://10.20.30.40:4096
7878

7979
#### Optionen
8080

81-
| Flag | Kurz | Beschreibung |
82-
| ----------- | ---- | ----------------------------------------- |
83-
| `--dir` | | Arbeitsverzeichnis zum Starten von TUI in |
84-
| `--session` | `-s` | Session-ID zum Fortfahren |
81+
| Flag | Kurz | Beschreibung |
82+
| ------------ | ---- | ---------------------------------------------------------------------------------- |
83+
| `--dir` | | Arbeitsverzeichnis zum Starten von TUI in |
84+
| `--continue` | `-c` | Letzte Sitzung fortsetzen |
85+
| `--session` | `-s` | Session-ID zum Fortfahren |
86+
| `--fork` | | Sitzung beim Fortsetzen abzweigen (mit `--continue` oder `--session` verwenden) |
87+
| `--password` | `-p` | Basic-Auth-Passwort (standardmäßig `OPENCODE_SERVER_PASSWORD`) |
88+
| `--username` | `-u` | Basic-Auth-Benutzername (standardmäßig `OPENCODE_SERVER_USERNAME` oder `opencode`) |
8589

8690
---
8791

packages/web/src/content/docs/es/cli.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ opencode attach http://10.20.30.40:4096
7878

7979
#### Opciones
8080

81-
| Opción | Corta | Descripción |
82-
| ----------- | ----- | ----------------------------------------- |
83-
| `--dir` | | Directorio de trabajo para iniciar TUI en |
84-
| `--session` | `-s` | ID de sesión para continuar |
81+
| Opción | Corta | Descripción |
82+
| ------------ | ----- | ----------------------------------------------------------------------------------------- |
83+
| `--dir` | | Directorio de trabajo para iniciar TUI en |
84+
| `--continue` | `-c` | Continuar la última sesión |
85+
| `--session` | `-s` | ID de sesión para continuar |
86+
| `--fork` | | Bifurcar la sesión al continuar (usar con `--continue` o `--session`) |
87+
| `--password` | `-p` | Contraseña de autenticación básica (predeterminada: `OPENCODE_SERVER_PASSWORD`) |
88+
| `--username` | `-u` | Usuario de autenticación básica (predeterminado: `OPENCODE_SERVER_USERNAME` u `opencode`) |
8589

8690
---
8791

packages/web/src/content/docs/fr/cli.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ opencode attach http://10.20.30.40:4096
7878

7979
#### Options
8080

81-
| Option | Court | Description |
82-
| ----------- | ----- | ---------------------------------------------- |
83-
| `--dir` | | Répertoire de travail dans lequel démarrer TUI |
84-
| `--session` | `-s` | ID de session pour continuer |
81+
| Option | Court | Description |
82+
| ------------ | ----- | -------------------------------------------------------------------------------------------------- |
83+
| `--dir` | | Répertoire de travail dans lequel démarrer TUI |
84+
| `--continue` | `-c` | Continuer la dernière session |
85+
| `--session` | `-s` | ID de session pour continuer |
86+
| `--fork` | | Dupliquer la session lors de la reprise (à utiliser avec `--continue` ou `--session`) |
87+
| `--password` | `-p` | Mot de passe d'authentification de base (par défaut `OPENCODE_SERVER_PASSWORD`) |
88+
| `--username` | `-u` | Nom d'utilisateur d'authentification de base (par défaut `OPENCODE_SERVER_USERNAME` ou `opencode`) |
8589

8690
---
8791

packages/web/src/content/docs/it/cli.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ opencode attach http://10.20.30.40:4096
7878

7979
#### Flag
8080

81-
| Flag | Breve | Descrizione |
82-
| ----------- | ----- | --------------------------------------- |
83-
| `--dir` | | Working directory in cui avviare la TUI |
84-
| `--session` | `-s` | ID sessione da continuare |
81+
| Flag | Breve | Descrizione |
82+
| ------------ | ----- | ----------------------------------------------------------------------------------------------- |
83+
| `--dir` | | Directory di lavoro in cui avviare la TUI |
84+
| `--continue` | `-c` | Continua l'ultima sessione |
85+
| `--session` | `-s` | ID sessione da continuare |
86+
| `--fork` | | Crea un fork della sessione durante la continuazione (usa con `--continue` o `--session`) |
87+
| `--password` | `-p` | Password per l'autenticazione di base (predefinita: `OPENCODE_SERVER_PASSWORD`) |
88+
| `--username` | `-u` | Nome utente per l'autenticazione di base (predefinito: `OPENCODE_SERVER_USERNAME` o `opencode`) |
8589

8690
---
8791

packages/web/src/content/docs/ja/cli.mdx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ opencode attach http://10.20.30.40:4096
7878

7979
#### フラグ
8080

81-
| フラグ | ショート | 説明 |
82-
| ----------- | -------- | ------------------------------ |
83-
| `--dir` | | TUI を開始する作業ディレクトリ |
84-
| `--session` | `-s` | 続行するセッション ID |
81+
| フラグ | ショート | 説明 |
82+
| ------------ | -------- | --------------------------------------------------------------------------------- |
83+
| `--dir` | | TUI を開始する作業ディレクトリ |
84+
| `--continue` | `-c` | 最後のセッションを続行 |
85+
| `--session` | `-s` | 続行するセッション ID |
86+
| `--fork` | | 続行時にセッションをフォーク(`--continue` または `--session` と使用) |
87+
| `--password` | `-p` | Basic 認証パスワード(デフォルトは `OPENCODE_SERVER_PASSWORD`|
88+
| `--username` | `-u` | Basic 認証ユーザー名(デフォルトは `OPENCODE_SERVER_USERNAME` または `opencode`|
8589

8690
---
8791

0 commit comments

Comments
 (0)