### Compile and Run CodexBar Application Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md This script orchestrates the complete development build and run process for CodexBar. It includes killing existing instances, building the release version, running tests, packaging the application, and finally launching it. ```bash ./Scripts/compile_and_run.sh ``` -------------------------------- ### Setup Git Remotes and Check Upstreams Source: https://github.com/steipete/codexbar/blob/main/FORK_STATUS.md This sequence configures the 'upstream' and 'quotio' Git remotes and then executes a script to check the status of these remotes. This is part of 'Option 3: Merge Current Work, Setup System'. ```bash # Setup remotes git remote add upstream https://github.com/steipete/CodexBar.git git remote add quotio https://github.com/nguyenphutrong/quotio.git # Start using the system ./Scripts/check_upstreams.sh ``` -------------------------------- ### Troubleshooting App Launch Issues in CodexBar Source: https://github.com/steipete/codexbar/blob/main/docs/FORK_QUICK_START.md Bash commands to fix issues where the CodexBar application fails to launch. This includes terminating all running instances and then rebuilding and relaunching the app. ```bash # Kill all instances pkill -x CodexBar || pkill -f CodexBar.app || true # Rebuild and relaunch ./Scripts/compile_and_run.sh ``` -------------------------------- ### Run CodexBar Unit Tests Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md This command executes all defined unit tests for the CodexBar project using Swift Package Manager. It is a standalone command to verify the correctness of the codebase. ```bash swift test ``` -------------------------------- ### Git Workflow for CodexBar Fork Source: https://github.com/steipete/codexbar/blob/main/docs/FORK_QUICK_START.md Essential Git commands for managing branches, committing changes, and pushing to the CodexBar fork repository. Includes commands for status checks, creating feature branches, and pushing updates. ```bash # Check status git status # Create feature branch git checkout -b feature/my-feature # Commit changes git add -A git commit -m "feat: description" # Push to fork git push origin feature/my-feature # Sync with upstream (TBD - see docs/FORK_ROADMAP.md Phase 4) ``` -------------------------------- ### Define Example Provider Descriptor in Swift Source: https://context7.com/steipete/codexbar/llms.txt This Swift code defines an example provider descriptor for CodexBar. It utilizes macros for automatic registration and specifies metadata, branding, fetch strategies, and CLI configuration for the provider. ```swift import CodexBarMacroSupport import Foundation @ProviderDescriptorRegistration @ProviderDescriptorDefinition public enum ExampleProviderDescriptor { static func makeDescriptor() -> ProviderDescriptor { ProviderDescriptor( id: .example, metadata: ProviderMetadata( id: .example, displayName: "Example", sessionLabel: "Session", weeklyLabel: "Weekly", opusLabel: nil, supportsOpus: false, supportsCredits: false, creditsHint: "", toggleTitle: "Show Example usage", cliName: "example", defaultEnabled: false, isPrimaryProvider: false, usesAccountFallback: false, dashboardURL: "https://example.com/dashboard", statusPageURL: "https://status.example.com/"), branding: ProviderBranding( iconStyle: .codex, iconResourceName: "ProviderIcon-example", color: ProviderColor(red: 0.2, green: 0.6, blue: 0.8)), tokenCost: ProviderTokenCostConfig( supportsTokenCost: false, noDataMessage: { "Example cost summary is not supported." }), fetchPlan: ProviderFetchPlan( sourceModes: [.auto, .cli, .api], pipeline: ProviderFetchPipeline(resolveStrategies: { context in [ExampleAPIFetchStrategy(), ExampleCLIFetchStrategy()] })), cli: ProviderCLIConfig( name: "example", aliases: ["ex"], versionDetector: nil)) } } ``` -------------------------------- ### Release Commands for CodexBar Fork Source: https://github.com/steipete/codexbar/blob/main/docs/FORK_QUICK_START.md Bash commands for managing the release process of the CodexBar fork. This includes signing, notarizing the application, and generating an appcast feed. ```bash # Sign and notarize (keep in foreground!) ./Scripts/sign-and-notarize.sh # Create appcast ./Scripts/make_appcast.sh # See full release process cat docs/RELEASING.md ``` -------------------------------- ### Configure Git Remotes and Fetch All Source: https://github.com/steipete/codexbar/blob/main/FORK_STATUS.md This snippet demonstrates how to add new remote repositories ('upstream' and 'quotio') to your local Git configuration and then fetch all branches from all configured remotes. This is a crucial first step for managing multiple upstream sources. ```bash # 1. Configure git remotes git remote add upstream https://github.com/steipete/CodexBar.git git remote add quotio https://github.com/nguyenphutrong/quotio.git git fetch --all ``` -------------------------------- ### Inspect Implementation Details Source: https://github.com/steipete/codexbar/blob/main/docs/QUOTIO_ANALYSIS.md Commands to locate and display specific source files within the repository to understand implementation patterns for accounts, sessions, and UI components. ```bash # Find account-related files git ls-tree -r --name-only quotio/main | grep -i account # View implementation (read-only) git show quotio/main:path/to/AccountManager.swift # Find session-related files git ls-tree -r --name-only quotio/main | grep -iE '(session|cookie|auth)' # Review implementation git show quotio/main:path/to/SessionManager.swift # Find UI files git ls-tree -r --name-only quotio/main | grep -iE '(view|menu|ui)' # Review layouts git show quotio/main:path/to/MenuBarView.swift ``` -------------------------------- ### Force Kill CodexBar Processes Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md This command forcefully terminates any running processes associated with 'CodexBar' or 'CodexBar.app'. It's a troubleshooting step to ensure no instances are running before a rebuild or deployment. ```bash pkill -x CodexBar || pkill -f CodexBar.app || true ``` -------------------------------- ### Build and Run CodexBar (Bash) Source: https://context7.com/steipete/codexbar/llms.txt Provides command-line instructions for building and running the CodexBar application using Swift Package Manager. Covers release builds, packaging the app bundle, ad-hoc signing, development builds, running tests, linting, and installing the CLI. ```bash # Build release binary swift build -c release # Build CLI only (for Linux) swift build -c release --product CodexBarCLI # Package macOS app bundle ./Scripts/package_app.sh # Ad-hoc signing (no Apple Developer account) CODEXBAR_SIGNING=adhoc ./Scripts/package_app.sh # Development build and run ./Scripts/compile_and_run.sh # Run tests swift test # Lint and format ./Scripts/lint.sh # Install CLI symlinks ln -sf "/Applications/CodexBar.app/Contents/Helpers/CodexBarCLI" /usr/local/bin/codexbar ``` -------------------------------- ### Troubleshooting Build Errors in CodexBar Source: https://github.com/steipete/codexbar/blob/main/docs/FORK_QUICK_START.md Bash commands to resolve build issues in the CodexBar project. This involves cleaning the build cache and checking for formatting and linting errors. ```bash # Clean build swift package clean swift build # Check for format issues swiftformat Sources Tests --lint swiftlint --strict ``` -------------------------------- ### CodexBar CLI Usage Examples Source: https://context7.com/steipete/codexbar/llms.txt Demonstrates various ways to use the `codexbar` CLI to fetch usage data from configured AI coding assistant providers. Supports filtering by provider, output format (text/JSON), source mode, and multi-account selection. ```bash # Basic usage - text output for enabled providers codexbar # Query specific provider with JSON output codexbar --provider claude --format json --pretty # Query all providers with status information codexbar --provider all --status --format json --pretty # Force specific source mode (web/cli/oauth/api) codexbar --provider codex --source web --format json --pretty # Multi-account support - query specific account codexbar --provider claude --account user@example.com # Query all accounts for a provider codexbar --provider claude --all-accounts --format json --pretty # Include verbose output and custom log level codexbar --provider codex --verbose --log-level debug ``` -------------------------------- ### Restart Terminal Session Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md After modifying shell configuration files like ~/.zshrc, this command reloads the configuration for the current terminal session. This ensures that environment variables, such as APP_IDENTITY, are applied immediately. ```bash source ~/.zshrc ``` -------------------------------- ### Build and Package CodexBar from Source Source: https://github.com/steipete/codexbar/blob/main/README.md Commands to compile the Swift project in release or debug mode and package the application. Includes an option for ad-hoc signing for local development without an Apple Developer account. ```bash swift build -c release # or debug for development ./Scripts/package_app.sh # builds CodexBar.app in-place CODEXBAR_SIGNING=adhoc ./Scripts/package_app.sh # ad-hoc signing (no Apple Developer account) open CodexBar.app ``` -------------------------------- ### POST /exa.language_server_pb.LanguageServerService/GetUserStatus Source: https://github.com/steipete/codexbar/blob/main/docs/antigravity.md Fetches user quota information, model configurations, and account details from the Antigravity provider. ```APIDOC ## POST /exa.language_server_pb.LanguageServerService/GetUserStatus ### Description Retrieves the current user status, including quota remaining fractions and model configuration data. ### Method POST ### Endpoint https://127.0.0.1:/exa.language_server_pb.LanguageServerService/GetUserStatus ### Parameters #### Request Body - **ideName** (string) - Required - Set to "antigravity". - **extensionName** (string) - Required - Set to "antigravity". - **locale** (string) - Required - User locale (e.g., "en"). - **ideVersion** (string) - Required - Version string or "unknown". ### Request Example { "ideName": "antigravity", "extensionName": "antigravity", "locale": "en", "ideVersion": "unknown" } ### Response #### Success Response (200) - **userStatus** (object) - Contains quotaInfo, remainingFraction, and resetTime. - **accountEmail** (string) - User account email. - **planName** (string) - Current subscription plan. #### Response Example { "userStatus": { "cascadeModelConfigData": { "clientModelConfigs": [{ "quotaInfo": { "remainingFraction": 0.85, "resetTime": "2023-12-31T23:59:59Z" } }] } } } ``` -------------------------------- ### Rebuild and Relaunch CodexBar Manually Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md This sequence of commands manually rebuilds and relaunches the CodexBar application. It involves packaging the app, killing any existing instances, and then opening the newly built application bundle. ```bash ./Scripts/package_app.sh pkill -x CodexBar || pkill -f CodexBar.app || true open -n CodexBar.app ``` -------------------------------- ### Development Commands for CodexBar Fork Source: https://github.com/steipete/codexbar/blob/main/docs/FORK_QUICK_START.md These bash commands are used for building, testing, and formatting the CodexBar project during development. They cover compilation, running tests, code linting, and packaging the application. ```bash # Build and run (kills old instances, builds, tests, packages, relaunches) ./Scripts/compile_and_run.sh # Quick build swift build # Run tests swift test # Format code swiftformat Sources Tests swiftlint --strict # Package app ./Scripts/package_app.sh # Restart app after rebuild pkill -x CodexBar || pkill -f CodexBar.app || true cd /Users/steipete/Projects/codexbar && open -n /Users/steipete/Projects/codexbar/CodexBar.app ``` -------------------------------- ### Quick Build CodexBar (Release Mode) Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md This command performs a release build of the CodexBar project using Swift Package Manager without running tests. It is followed by a script to package the built application. ```bash swift build -c release ./Scripts/package_app.sh ``` -------------------------------- ### Build, Sign, and Notarize Application Source: https://github.com/steipete/codexbar/blob/main/docs/RELEASING.md Executes the full build pipeline for universal binaries (arm64 and x86_64), codesigns the application bundle, and submits it to Apple for notarization. ```bash ./Scripts/sign-and-notarize.sh ``` -------------------------------- ### POST /exa.language_server_pb.LanguageServerService/GetUnleashData Source: https://github.com/steipete/codexbar/blob/main/docs/antigravity.md Probes the discovered local port to verify the connection to the Antigravity language server. ```APIDOC ## POST /exa.language_server_pb.LanguageServerService/GetUnleashData ### Description Probes a local port to verify the Antigravity language server availability using HTTPS. ### Method POST ### Endpoint https://127.0.0.1:/exa.language_server_pb.LanguageServerService/GetUnleashData ### Parameters #### Request Headers - **X-Codeium-Csrf-Token** (string) - Required - The CSRF token extracted from the process CLI flags. - **Connect-Protocol-Version** (string) - Required - Set to "1". ### Request Example {} ### Response #### Success Response (200) - **status** (string) - Indicates successful connection. #### Response Example { "status": "ok" } ``` -------------------------------- ### Testing Commands for CodexBar Fork Source: https://github.com/steipete/codexbar/blob/main/docs/FORK_QUICK_START.md Bash commands for executing tests within the CodexBar project. This includes running all tests, filtering for specific test suites, and integrating testing with the build process. ```bash # Run all tests swift test # Run specific test swift test --filter AugmentTests # Build and test together ./Scripts/compile_and_run.sh ``` -------------------------------- ### POST /_server Source: https://github.com/steipete/codexbar/blob/main/docs/opencode.md Executes server-side functions on opencode.ai to retrieve workspace and subscription data. ```APIDOC ## POST /_server ### Description Executes remote server functions for OpenCode. The response is returned as `text/javascript` containing serialized objects which must be parsed via regex. ### Method POST ### Endpoint `https://opencode.ai/_server` ### Request Body - **id** (string) - Required - The server function ID (e.g., `def39973159c7f0483d8793a822b8dbb10d067e12c65455fcb4608459ba0234f` for workspaces). ### Request Example { "id": "def39973159c7f0483d8793a822b8dbb10d067e12c65455fcb4608459ba0234f" } ### Response #### Success Response (200) - **rollingUsage** (object) - Contains `usagePercent` and `resetInSec` for 5-hour window. - **weeklyUsage** (object) - Contains `usagePercent` and `resetInSec` for weekly window. #### Response Example { "rollingUsage": { "usagePercent": 0.5, "resetInSec": 3600 }, "weeklyUsage": { "usagePercent": 0.1, "resetInSec": 86400 } } ``` -------------------------------- ### App Distribution Scripts Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT.md Scripts for creating local development builds and notarized release builds for distribution. ```bash # Local development build ./Scripts/package_app.sh # Release build (notarized) ./Scripts/sign-and-notarize.sh ``` -------------------------------- ### Create Development Certificate for CodexBar Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md This script generates a self-signed certificate named 'CodexBar Development' to be used for code signing during local development. This helps in reducing frequent Keychain permission prompts by providing a stable identity. ```bash ./Scripts/setup_dev_signing.sh ``` -------------------------------- ### CodexBar CLI Config Command Examples Source: https://context7.com/steipete/codexbar/llms.txt Illustrates the use of `codexbar config` commands for validating and inspecting the `~/.codexbar/config.json` file. Supports JSON output and a JSON-only mode for scripting. ```bash # Validate config file for errors codexbar config validate # Validate with JSON output codexbar config validate --format json --pretty # Dump normalized config codexbar config dump --pretty # JSON-only mode (suppress non-JSON output, errors as JSON payloads) codexbar config validate --json-only --format json --pretty ``` -------------------------------- ### Execute CodexBar Usage Fetch (Shell Command) Source: https://github.com/steipete/codexbar/blob/main/docs/codex-oauth.md An example of how to invoke the CodexBar CLI to fetch usage data using the OAuth provider and source. The `--json` and `--pretty` flags ensure formatted JSON output, aiding in analysis. ```shell CodexBarCLI usage --provider codex --source oauth --json --pretty ``` -------------------------------- ### Debug Build and Package CodexBar Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md This command initiates a debug build of the CodexBar project using Swift Package Manager and then packages the application in debug mode. The default Swift build is typically in debug configuration unless specified otherwise. ```bash swift build # defaults to debug ./Scripts/package_app.sh debug ``` -------------------------------- ### Clean Up Old CodexBar App Bundles Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md This command removes all application bundles matching the pattern 'CodexBar *.app' from the current directory. It's useful for cleaning up old builds that may accumulate due to Finder's inability to overwrite a running application. ```bash rm -rf "CodexBar "*.app ``` -------------------------------- ### Analyze External Repository Patterns Source: https://github.com/steipete/codexbar/blob/main/docs/FORK_SETUP.md Commands to inspect specific files in an external repository to study architectural patterns and implementation details without copying code directly. ```bash git fetch quotio git show quotio/main:path/to/AccountManager.swift ``` -------------------------------- ### Configure Shell for Stable Signing Identity Source: https://github.com/steipete/codexbar/blob/main/docs/DEVELOPMENT_SETUP.md This command exports the 'CodexBar Development' certificate as the application identity in your shell environment. Add this to your shell's configuration file (e.g., ~/.zshrc) to ensure it's set on terminal startup, enabling stable code signing. ```bash export APP_IDENTITY='CodexBar Development' ``` -------------------------------- ### Manual Cookie Capture and Import Source: https://github.com/steipete/codexbar/blob/main/docs/minimax.md Instructions on how to manually capture and import cookie headers for authentication when automatic methods fail. ```APIDOC ## Manual Cookie Capture and Import ### Description This guide explains how to manually capture cookie information from browser developer tools and import it into CodexBar if automatic cookie handling is unsuccessful. ### Steps: 1. **Navigate**: Open the Coding Plan page in your browser. 2. **Open DevTools**: Access your browser's Developer Tools and go to the Network tab. 3. **Identify Request**: Locate the request to `/v1/api/openplatform/coding_plan/remains`. 4. **Copy Header**: Copy the `Cookie` request header. Alternatively, use the "Copy as cURL" option and paste the entire string. 5. **Import**: Paste the captured cookie information into the Preferences → Providers → MiniMax section, specifically in the "Cookie source" → "Manual" field. ### Notes: - Cookies alone may sometimes result in status 1004 errors, as the remains API often expects a Bearer token. - The "Copy as cURL" option can also extract `Authorization: Bearer …` and `GroupId=…` headers. ```