From b020b201a0c3da42aa69505ad201c3d179076005 Mon Sep 17 00:00:00 2001 From: activadee Date: Sun, 4 Jan 2026 14:40:23 +0100 Subject: [PATCH] feat: change default secret name to OPENCODE_AUTH Simplified the default GitHub secret name from OPENCODE_AUTH_JSON to OPENCODE_AUTH for better readability and convention alignment. --- README.md | 6 +++--- cli.ts | 4 ++-- lib/config.test.ts | 6 +++--- lib/config.ts | 2 +- opencode-auth-sync.example.json | 2 +- schema.json | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6a23bd7..d9ce661 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Create `~/.config/opencode/opencode-auth-sync.json`: |--------|------|---------|-------------| | `enabled` | boolean | `true` | Enable/disable the plugin | | `credentialsPath` | string | `~/.local/share/opencode/auth.json` | Path to OpenCode auth file | -| `secretName` | string | `OPENCODE_AUTH_JSON` | GitHub secret name | +| `secretName` | string | `OPENCODE_AUTH` | GitHub secret name | | `repositories` | string[] | `[]` | Repositories to sync (`owner/repo` format) | | `debounceMs` | number | `1000` | Debounce delay for file changes | @@ -78,7 +78,7 @@ jobs: - name: Setup OpenCode Auth run: | mkdir -p ~/.local/share/opencode - echo '${{ secrets.OPENCODE_AUTH_JSON }}' > ~/.local/share/opencode/auth.json + echo '${{ secrets.OPENCODE_AUTH }}' > ~/.local/share/opencode/auth.json ``` ### Extracting Specific Tokens @@ -86,7 +86,7 @@ jobs: ```yaml - name: Extract Anthropic Token run: | - ANTHROPIC_TOKEN=$(echo '${{ secrets.OPENCODE_AUTH_JSON }}' | jq -r '.anthropic.access') + ANTHROPIC_TOKEN=$(echo '${{ secrets.OPENCODE_AUTH }}' | jq -r '.anthropic.access') echo "::add-mask::$ANTHROPIC_TOKEN" echo "ANTHROPIC_API_KEY=$ANTHROPIC_TOKEN" >> $GITHUB_ENV ``` diff --git a/cli.ts b/cli.ts index 4c4c253..ae6857e 100755 --- a/cli.ts +++ b/cli.ts @@ -145,7 +145,7 @@ async function main() { process.exit(0) } - const existingSecretName = existingConfig.secretName || "OPENCODE_AUTH_JSON" + const existingSecretName = existingConfig.secretName || "OPENCODE_AUTH" const secretName = await p.text({ message: "GitHub secret name", placeholder: existingSecretName, @@ -201,7 +201,7 @@ async function main() { p.note( [ `${color.dim("Plugin config:")} ~/.config/opencode/opencode-auth-sync.json`, - `${color.dim("Secret name:")} ${secretName || "OPENCODE_AUTH_JSON"}`, + `${color.dim("Secret name:")} ${secretName || "OPENCODE_AUTH"}`, `${color.dim("Repositories:")} ${(selectedRepos as string[]).length} selected`, "", ...((selectedRepos as string[]).map((r) => ` ${color.green("✓")} ${r}`)), diff --git a/lib/config.test.ts b/lib/config.test.ts index 090b9e1..05fdde7 100644 --- a/lib/config.test.ts +++ b/lib/config.test.ts @@ -213,7 +213,7 @@ describe("config merge integration", () => { enabled: true, debounceMs: 10000, credentialsPath: "~/.local/share/opencode/auth.json", - secretName: "OPENCODE_AUTH_JSON", + secretName: "OPENCODE_AUTH", repositories: ["org/repo1", "org/repo2"], } writeFileSync(testConfigPath, JSON.stringify(originalConfig)) @@ -221,7 +221,7 @@ describe("config merge integration", () => { const loaded = loadPluginConfigSync(testConfigPath) const reinstallUpdates = { repositories: ["org/repo1", "org/repo3"], - secretName: "OPENCODE_AUTH_JSON", + secretName: "OPENCODE_AUTH", } const merged = mergeConfig(loaded, reinstallUpdates) @@ -234,7 +234,7 @@ describe("DEFAULT_CONFIG", () => { test("has expected default values", () => { expect(DEFAULT_CONFIG.enabled).toBe(true) expect(DEFAULT_CONFIG.credentialsPath).toBe("~/.local/share/opencode/auth.json") - expect(DEFAULT_CONFIG.secretName).toBe("OPENCODE_AUTH_JSON") + expect(DEFAULT_CONFIG.secretName).toBe("OPENCODE_AUTH") expect(DEFAULT_CONFIG.repositories).toEqual([]) expect(DEFAULT_CONFIG.debounceMs).toBe(1000) }) diff --git a/lib/config.ts b/lib/config.ts index 41a4994..68e2ef3 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -7,7 +7,7 @@ import type { AuthSyncConfig } from "./types" export const DEFAULT_CONFIG: AuthSyncConfig = { enabled: true, credentialsPath: "~/.local/share/opencode/auth.json", - secretName: "OPENCODE_AUTH_JSON", + secretName: "OPENCODE_AUTH", repositories: [], debounceMs: 1000, } diff --git a/opencode-auth-sync.example.json b/opencode-auth-sync.example.json index 9350a3b..326a08f 100644 --- a/opencode-auth-sync.example.json +++ b/opencode-auth-sync.example.json @@ -2,7 +2,7 @@ "$schema": "https://raw.githubusercontent.com/activadee/opencode-auth-sync/main/schema.json", "enabled": true, "credentialsPath": "~/.local/share/opencode/auth.json", - "secretName": "OPENCODE_AUTH_JSON", + "secretName": "OPENCODE_AUTH", "repositories": [ "your-username/repo1", "your-org/private-repo" diff --git a/schema.json b/schema.json index 2e54be0..78ac76f 100644 --- a/schema.json +++ b/schema.json @@ -19,7 +19,7 @@ }, "secretName": { "type": "string", - "default": "OPENCODE_AUTH_JSON", + "default": "OPENCODE_AUTH", "description": "Name of the GitHub secret to create/update" }, "repositories": {