-
Notifications
You must be signed in to change notification settings - Fork 0
Coder #389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Coder #389
Changes from all commits
4224e2f
05f3692
02d7598
a1b5285
c3f5cdf
29b913f
40860b7
c65da1c
238b516
3bb7cf7
cba3383
74b4d3c
cf9d27d
c5bf0f3
edade9a
f976f17
949def1
073da2a
d7d6fce
2ae7e0c
1629387
58c68d6
c1c6c2f
bcaf79d
a9f6128
6a6db05
1ef0639
802f2af
b00bda2
7bfe27e
e130484
975c648
c68684c
ad39434
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { config, ... }: | ||
| { | ||
| xdg.configFile."amp/settings.json" = { | ||
| source = config.lib.file.mkOutOfStoreSymlink ./settings.json; | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "amp.url": "http://localhost:8317" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| # Server port | ||
| port: 8317 | ||
| # Management API settings | ||
| remote-management: | ||
| # Whether to allow remote (non-localhost) management access. | ||
| # When false, only localhost can access management endpoints (a key is still required). | ||
| allow-remote: false | ||
| # Management key. If a plaintext value is provided here, it will be hashed on startup. | ||
| # All management requests (even from localhost) require this key. | ||
| # Leave empty to disable the Management API entirely (404 for all /v0/management routes). | ||
| secret-key: "" | ||
| # Disable the bundled management control panel asset download and HTTP route when true. | ||
| disable-control-panel: false | ||
| # Authentication directory (supports ~ for home directory). If you use Windows, please set the directory like this: `C:/cli-proxy-api/` | ||
| auth-dir: "~/.cli-proxy-api" | ||
| # API keys for authentication | ||
| # api-keys: | ||
| # - "your-api-key-1" | ||
| # - "your-api-key-2" | ||
|
|
||
| # Enable debug logging | ||
| debug: true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| # When true, write application logs to rotating files instead of stdout | ||
| logging-to-file: true | ||
| # When false, disable in-memory usage statistics aggregation | ||
| usage-statistics-enabled: true | ||
| # Proxy URL. Supports socks5/http/https protocols. Example: socks5://user:pass@192.168.1.1:1080/ | ||
| proxy-url: "" | ||
| # Number of times to retry a request. Retries will occur if the HTTP response code is 403, 408, 500, 502, 503, or 504. | ||
| request-retry: 3 | ||
| # Quota exceeded behavior | ||
| quota-exceeded: | ||
| switch-project: true # Whether to automatically switch to another project when a quota is exceeded | ||
| switch-preview-model: true # Whether to automatically switch to a preview model when a quota is exceeded | ||
| # When true, enable authentication for the WebSocket API (/v1/ws). | ||
| ws-auth: false | ||
| # AMP | ||
| ampcode: | ||
| upstream-url: "https://ampcode.com" | ||
| restrict-management-to-localhost: true | ||
| # amp-upstream-api-key: "" # Optional - use AMP_API_KEY env var or ~/.local/share/amp/secrets.json | ||
|
|
||
| # Gemini API keys (preferred) | ||
| # gemini-api-key: | ||
| # - api-key: "AIzaSy...01" | ||
| # base-url: "https://generativelanguage.googleapis.com" | ||
| # headers: | ||
| # X-Custom-Header: "custom-value" | ||
| # proxy-url: "socks5://proxy.example.com:1080" | ||
| # - api-key: "AIzaSy...02" | ||
|
|
||
| # Codex API keys | ||
| # codex-api-key: | ||
| # - api-key: "sk-atSM..." | ||
| # base-url: "https://www.example.com" # use the custom codex API endpoint | ||
| # headers: | ||
| # X-Custom-Header: "custom-value" | ||
| # proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override | ||
|
|
||
| # Claude API keys | ||
| # claude-api-key: | ||
| # - api-key: "sk-atSM..." # use the official claude API key, no need to set the base url | ||
| # - api-key: "sk-atSM..." | ||
| # base-url: "https://www.example.com" # use the custom claude API endpoint | ||
| # headers: | ||
| # X-Custom-Header: "custom-value" | ||
| # proxy-url: "socks5://proxy.example.com:1080" # optional: per-key proxy override | ||
| # models: | ||
| # - name: "claude-3-5-sonnet-20241022" # upstream model name | ||
| # alias: "claude-sonnet-latest" # client alias mapped to the upstream model | ||
|
|
||
| # OpenAI compatibility providers | ||
| openai-compatibility: | ||
| - name: "openrouter" | ||
| base-url: "https://openrouter.ai/api/v1" | ||
| api-keys: | ||
| - "__OPENROUTER_API_KEY__" | ||
| models: | ||
| - name: "z-ai/glm-4.6" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Placeholder syntax OPENROUTER_API_KEY gets replaced by sed in start.sh, but if replacement fails, this literal string remains in the config. Consider using cliproxyapi's native environment variable support (if available) or the agenix secret management system already established in this repository for more robust secret injection. |
||
|
|
||
| # payload: # Optional payload configuration | ||
| # default: # Default rules only set parameters when they are missing in the payload. | ||
| # - models: | ||
| # - name: "gemini-2.5-pro" # Supports wildcards (e.g., "gemini-*") | ||
| # protocol: "gemini" # restricts the rule to a specific protocol, options: openai, gemini, claude, codex | ||
| # params: # JSON path (gjson/sjson syntax) -> value | ||
| # "generationConfig.thinkingConfig.thinkingBudget": 32768 | ||
| # override: # Override rules always set parameters, overwriting any existing values. | ||
| # - models: | ||
| # - name: "gpt-*" # Supports wildcards (e.g., "gpt-*") | ||
| # protocol: "codex" # restricts the rule to a specific protocol, options: openai, gemini, claude, codex | ||
| # params: # JSON path (gjson/sjson syntax) -> value | ||
| # "reasoning.effort": "high" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { config, ... }: | ||
| { | ||
| # Template config - the service wrapper injects secrets and writes to config.yaml | ||
| home.file.".cli-proxy-api/config.template.yaml" = { | ||
| source = config.lib.file.mkOutOfStoreSymlink ./config.yaml; | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| [ | ||
| ./amp | ||
| ./cliproxyapi | ||
| ./codex | ||
| ./crush | ||
| ./claude | ||
| ./direnv | ||
| ./factory | ||
| ./ghostty | ||
| ./hammerspoon | ||
| ./karabiner | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "custom_models": [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "model": "gemini-3-pro-preview", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "base_url": "http://127.0.0.1:8317/v1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "api_key": "sk-dummy", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider": "openai" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "model": "gpt-5.1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "base_url": "http://127.0.0.1:8317/v1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "api_key": "sk-dummy", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider": "openai" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "model": "gpt-5.1-codex", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "base_url": "http://127.0.0.1:8317/v1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "api_key": "sk-dummy", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider": "openai" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "model": "gpt-5.1-codex-max", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "base_url": "http://127.0.0.1:8317/v1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "api_key": "sk-dummy", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider": "openai" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "model": "claude-opus-4-5-20251101", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "base_url": "http://127.0.0.1:8317/v1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "api_key": "sk-dummy", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "provider": "anthropic" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "model": "claude-haiku-4-5-20251001", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "base_url": "http://127.0.0.1:8317/v1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+5
to
+35
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "base_url": "http://127.0.0.1:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "openai" | |
| }, | |
| { | |
| "model": "gpt-5.1", | |
| "base_url": "http://127.0.0.1:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "openai" | |
| }, | |
| { | |
| "model": "gpt-5.1-codex", | |
| "base_url": "http://127.0.0.1:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "openai" | |
| }, | |
| { | |
| "model": "gpt-5.1-codex-max", | |
| "base_url": "http://127.0.0.1:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "openai" | |
| }, | |
| { | |
| "model": "claude-opus-4-5-20251101", | |
| "base_url": "http://127.0.0.1:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "anthropic" | |
| }, | |
| { | |
| "model": "claude-haiku-4-5-20251001", | |
| "base_url": "http://127.0.0.1:8317/v1", | |
| "base_url": "http://localhost:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "openai" | |
| }, | |
| { | |
| "model": "gpt-5.1", | |
| "base_url": "http://localhost:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "openai" | |
| }, | |
| { | |
| "model": "gpt-5.1-codex", | |
| "base_url": "http://localhost:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "openai" | |
| }, | |
| { | |
| "model": "gpt-5.1-codex-max", | |
| "base_url": "http://localhost:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "openai" | |
| }, | |
| { | |
| "model": "claude-opus-4-5-20251101", | |
| "base_url": "http://localhost:8317/v1", | |
| "api_key": "sk-dummy", | |
| "provider": "anthropic" | |
| }, | |
| { | |
| "model": "claude-haiku-4-5-20251001", | |
| "base_url": "http://localhost:8317/v1", |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { config, ... }: | ||
| { | ||
| home.file.".factory/config.json" = { | ||
| source = config.lib.file.mkOutOfStoreSymlink ./config.json; | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| fish_add_path -p /nix/var/nix/profiles/default/bin | ||
| fish_add_path -p ~/.foundry/bin | ||
| fish_add_path -p /opt/homebrew/bin | ||
| fish_add_path -p /opt/homebrew/opt/postgresql@18/bin | ||
| fish_add_path -p /etc/profiles/per-user/${config.home.username}/bin | ||
| ''; | ||
| interactiveShellInit = '' | ||
|
|
@@ -30,6 +31,7 @@ | |
| fish_add_path -p /nix/var/nix/profiles/default/bin | ||
| fish_add_path -p ~/.foundry/bin | ||
| fish_add_path -p /opt/homebrew/bin | ||
| fish_add_path -p /opt/homebrew/opt/postgresql@18/bin | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| fish_add_path -p /etc/profiles/per-user/${config.home.username}/bin | ||
| set -a fish_complete_path ~/.nix-profile/share/fish/completions/ ~/.nix-profile/share/fish/vendor_completions.d/ | ||
| set -x FISH_HISTFILE fish | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,19 @@ | ||||||
| { pkgs, ... }: | ||||||
| { | ||||||
| launchd.agents.cliproxyapi = pkgs.lib.mkIf pkgs.stdenv.isDarwin { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| enable = true; | ||||||
| config = { | ||||||
| ProgramArguments = [ | ||||||
| "${pkgs.bash}/bin/bash" | ||||||
| "${./start.sh}" | ||||||
| ]; | ||||||
| Environment = { | ||||||
| PATH = "${pkgs.lib.makeBinPath [ pkgs.gnused ]}:/opt/homebrew/bin:/usr/local/bin"; | ||||||
|
||||||
| PATH = "${pkgs.lib.makeBinPath [ pkgs.gnused ]}:/opt/homebrew/bin:/usr/local/bin"; | |
| PATH = "${pkgs.lib.makeBinPath [ pkgs.gnused ]}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log files are being written to /tmp, which is an ephemeral directory. Its contents may be cleared on system reboot. For persistent logging, consider using a more permanent location, such as ~/Library/Logs/cliproxyapi/ on macOS. Note that you would need to provide an absolute path in the launchd configuration as it does not expand ~.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||||||||||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| CONFIG_DIR="$HOME/.cli-proxy-api" | ||||||||||||||||||||||||||||||
| TEMPLATE="$CONFIG_DIR/config.template.yaml" | ||||||||||||||||||||||||||||||
| CONFIG="$CONFIG_DIR/config.yaml" | ||||||||||||||||||||||||||||||
| ENV_FILE="$HOME/dotfiles/.env" | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded path assumes 'dotfiles' directory exists in $HOME, which may not be true on all systems. This repository uses agenix for secret management (see named-hosts/galactica/secrets.nix). Consider migrating to agenix: |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Source .env file to get API keys | ||||||||||||||||||||||||||||||
| if [ -f "$ENV_FILE" ]; then | ||||||||||||||||||||||||||||||
| set -a | ||||||||||||||||||||||||||||||
| # shellcheck source=/dev/null | ||||||||||||||||||||||||||||||
| source "$ENV_FILE" | ||||||||||||||||||||||||||||||
| set +a | ||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Generate config from template with secrets injected | ||||||||||||||||||||||||||||||
| if [ -f "$TEMPLATE" ]; then | ||||||||||||||||||||||||||||||
| sed "s|__OPENROUTER_API_KEY__|${OPENROUTER_API_KEY:-}|g" "$TEMPLATE" >"$CONFIG" | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Silent failure risk: If OPENROUTER_API_KEY is unset or empty, sed creates a config with an empty string, leading to subtle runtime failures. Add validation before sed replacement:
|
||||||||||||||||||||||||||||||
| sed "s|__OPENROUTER_API_KEY__|${OPENROUTER_API_KEY:-}|g" "$TEMPLATE" >"$CONFIG" | |
| export OPENROUTER_API_KEY | |
| envsubst < "$TEMPLATE" > "$CONFIG" |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The config generation on line 19-21 only runs if $TEMPLATE exists, but the cliproxyapi command on lines 34 and 36 always passes -config "$CONFIG". If the template doesn't exist, the config file won't be created, potentially causing cliproxyapi to fail. Consider either: 1) Making template generation mandatory with error handling, or 2) Only passing -config flag if the config file was successfully generated.
| if [ -f "$TEMPLATE" ]; then | |
| sed "s|__OPENROUTER_API_KEY__|${OPENROUTER_API_KEY:-}|g" "$TEMPLATE" >"$CONFIG" | |
| fi | |
| if [ ! -f "$TEMPLATE" ]; then | |
| echo "Config template '$TEMPLATE' not found. Cannot generate config file." >&2 | |
| exit 1 | |
| fi | |
| sed "s|__OPENROUTER_API_KEY__|${OPENROUTER_API_KEY:-}|g" "$TEMPLATE" >"$CONFIG" |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script attempts to cd "$CONFIG_DIR" without first verifying the directory exists. If ~/.cli-proxy-api doesn't exist, the script will fail. Consider adding a check: mkdir -p "$CONFIG_DIR" before line 24, or add error handling to verify the directory exists.
| # Change to config dir so logs are created there | |
| # Change to config dir so logs are created there | |
| mkdir -p "$CONFIG_DIR" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script hardcodes paths to find the cliproxyapi binary. A more robust approach is to rely on the PATH environment variable, which is already set in the launchd service definition. You can use command -v to check if the binary exists in the PATH and then execute it directly.
| if [ -x /opt/homebrew/bin/cliproxyapi ]; then | |
| exec /opt/homebrew/bin/cliproxyapi -config "$CONFIG" "$@" | |
| elif [ -x /usr/local/bin/cliproxyapi ]; then | |
| exec /usr/local/bin/cliproxyapi -config "$CONFIG" "$@" | |
| else | |
| echo 'cliproxyapi binary not found; install it with "brew install cliproxyapi"' >&2 | |
| exit 1 | |
| fi | |
| if command -v cliproxyapi >/dev/null; then | |
| exec cliproxyapi -config "$CONFIG" "$@" | |
| else | |
| echo 'cliproxyapi binary not found; install it with "brew install cliproxyapi"' >&2 | |
| exit 1 | |
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,9 @@ | |
| brews = [ | ||
| "bun" | ||
| "claude-squad" | ||
| "cliproxyapi" | ||
| "cmake" | ||
| "coder" | ||
| "colima" | ||
| "coreutils" | ||
| "ffmpeg" | ||
|
|
@@ -35,6 +37,7 @@ | |
| "pinentry-mac" | ||
| "pnpm" | ||
| "postgresql" | ||
| "postgresql@18" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| "protobuf" | ||
| "reth" | ||
| "sheldon" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded localhost:8317. If cliproxyapi port changes, this and 4 other config files need manual updates (codex/config.toml, factory/config.json, opencode/opencode.jsonc). Consider extracting this to a shared Nix variable to maintain DRY principles:
proxyPort = 8317;then reference it across configs.Agent: 🏛 Architecture