-
Notifications
You must be signed in to change notification settings - Fork 0
chore: harden codex and swift setup #4
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
Changes from all commits
66e7b45
91e4545
8f279f2
98a1515
43d32ea
0b5d337
7824497
cf19b43
2e22416
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ratings: | ||
| paths: | ||
| - "src/**" | ||
| - "scripts/**" | ||
| - "build-assets/shared/**" | ||
| - "build-assets/swiftun-shell/Sources/**" | ||
|
|
||
| exclude: | ||
| - "eliza/**" | ||
| - "dist-agent/**" | ||
| - "build-assets/**/Detour*.app/**" | ||
| - "build-assets/**/_CodeSignature/**" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if command -v xh >/dev/null 2>&1; then | ||
| xh _record-commit "${GIT_DIR:-.git}" || true | ||
| xh backup --bg || true | ||
| elif [[ -x /Users/home/.local/bin/xh ]]; then | ||
| /Users/home/.local/bin/xh _record-commit "${GIT_DIR:-.git}" || true | ||
| /Users/home/.local/bin/xh backup --bg || true | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| cd "$(git rev-parse --show-toplevel)" | ||
|
|
||
| bun run scripts/verify-codex-setup.ts --skip-xh-status --hook | ||
| git diff --cached --check | ||
|
|
||
| blocked=$( | ||
| git diff --cached --name-only --diff-filter=ACMR | | ||
| grep -E '(^|/)(\.env(\..*)?|\.agents/|\.eliza/|\.detour/|\.xhawk/|\.DS_Store$|.*\.log$|\.codex/(config\.toml|hooks\.json)$|\.cursor/hooks\.json$|\.gemini/settings\.json$|\.opencode/(node_modules/|package(-lock)?\.json$|plugins/xh-hooks\.js$)|eliza/.*-export\.jsonl?$)' || true | ||
| ) | ||
|
|
||
| if [[ -n "$blocked" ]]; then | ||
| printf 'pre-commit blocked local agent/runtime files:\n%s\n' "$blocked" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| large=$( | ||
| while IFS= read -r path; do | ||
| [[ -f "$path" ]] || continue | ||
| bytes=$(wc -c < "$path" | tr -d ' ') | ||
| if [[ "$bytes" -gt 95000000 ]]; then | ||
| printf '%s (%s bytes)\n' "$path" "$bytes" | ||
| fi | ||
| done < <(git diff --cached --name-only --diff-filter=ACMR) | ||
| ) | ||
|
|
||
| if [[ -n "$large" ]]; then | ||
| printf 'pre-commit blocked files over 95MB:\n%s\n' "$large" >&2 | ||
| exit 1 | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| cd "$(git rev-parse --show-toplevel)" | ||
|
|
||
| bun run scripts/verify-codex-setup.ts --hook | ||
| bun run verify:swift | ||
|
|
||
| TESTS=$(find src -name "*.test.ts" -not -path "*/node_modules/*") | ||
| if [[ -z "$TESTS" ]]; then | ||
| echo "pre-push found no src tests" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| bun test $TESTS | ||
|
Comment on lines
+9
to
+15
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. The current method of collecting test files with Using |
||
| bun run typecheck | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| node_modules | ||
| package.json | ||
| package-lock.json | ||
| bun.lock | ||
| .gitignore |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "$schema": "https://raw.githubusercontent.com/NoeFabris/opencode-antigravity-auth/main/assets/antigravity.schema.json", | ||
| "account_selection_strategy": "round-robin", | ||
| "switch_on_first_rate_limit": true, | ||
| "pid_offset_enabled": true, | ||
| "switch_on_error": true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| "$schema": "https://opencode.ai/config.json", | ||
| "plugin": [ | ||
| "opencode-antigravity-auth" | ||
| ], | ||
| "provider": { | ||
| "google": { | ||
| "models": { | ||
| "antigravity-gemini-3-pro": { | ||
| "name": "Gemini 3 Pro (Antigravity)", | ||
| "limit": { "context": 1048576, "output": 65535 }, | ||
| "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }, | ||
| "variants": { | ||
| "low": { "thinkingLevel": "low" }, | ||
| "high": { "thinkingLevel": "high" } | ||
| } | ||
| }, | ||
| "antigravity-gemini-3-flash": { | ||
| "name": "Gemini 3 Flash (Antigravity)", | ||
| "limit": { "context": 1048576, "output": 65536 }, | ||
| "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }, | ||
| "variants": { | ||
| "minimal": { "thinkingLevel": "minimal" }, | ||
| "low": { "thinkingLevel": "low" }, | ||
| "medium": { "thinkingLevel": "medium" }, | ||
| "high": { "thinkingLevel": "high" } | ||
| } | ||
| }, | ||
| "antigravity-claude-sonnet-4-6": { | ||
| "name": "Claude Sonnet 4.6 (Antigravity)", | ||
| "limit": { "context": 200000, "output": 64000 }, | ||
| "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] } | ||
| }, | ||
| "antigravity-claude-sonnet-4-6-thinking": { | ||
| "name": "Claude Sonnet 4.6 Thinking (Antigravity)", | ||
| "limit": { "context": 200000, "output": 64000 }, | ||
| "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }, | ||
| "variants": { | ||
| "low": { "thinkingConfig": { "thinkingBudget": 8192 } }, | ||
| "max": { "thinkingConfig": { "thinkingBudget": 32768 } } | ||
| } | ||
| }, | ||
| "antigravity-claude-opus-4-7-thinking": { | ||
| "name": "Claude Opus 4.7 Thinking (Antigravity)", | ||
| "limit": { "context": 200000, "output": 64000 }, | ||
| "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] }, | ||
| "variants": { | ||
| "low": { "thinkingConfig": { "thinkingBudget": 8192 } }, | ||
| "max": { "thinkingConfig": { "thinkingBudget": 32768 } } | ||
| } | ||
| }, | ||
| "gemini-2.5-flash": { | ||
| "name": "Gemini 2.5 Flash (Gemini CLI)", | ||
| "limit": { "context": 1048576, "output": 65536 }, | ||
| "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] } | ||
| }, | ||
| "gemini-2.5-pro": { | ||
| "name": "Gemini 2.5 Pro (Gemini CLI)", | ||
| "limit": { "context": 1048576, "output": 65536 }, | ||
| "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] } | ||
| }, | ||
| "gemini-3-flash-preview": { | ||
| "name": "Gemini 3 Flash Preview (Gemini CLI)", | ||
| "limit": { "context": 1048576, "output": 65536 }, | ||
| "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] } | ||
| }, | ||
| "gemini-3-pro-preview": { | ||
| "name": "Gemini 3 Pro Preview (Gemini CLI)", | ||
| "limit": { "context": 1048576, "output": 65535 }, | ||
| "modalities": { "input": ["text", "image", "pdf"], "output": ["text"] } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
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 contains a hardcoded user path
/Users/home/.local/bin/xh. This will only work for the user namedhomeand will fail for any other developer on their machine. This makes the hook not portable.To fix this, you should use a variable like
$HOMEor the~tilde expansion to refer to the current user's home directory. This will ensure the hook works correctly for all users.