{"id":50635258,"url":"https://github.com/vivswan/copilot-env","last_synced_at":"2026-06-13T00:02:09.251Z","repository":{"id":362801710,"uuid":"1258991131","full_name":"Vivswan/copilot-env","owner":"Vivswan","description":"Local copilot-api gateway lifecycle + config helper (TypeScript).","archived":false,"fork":false,"pushed_at":"2026-06-07T00:14:58.000Z","size":354,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-07T02:03:01.820Z","etag":null,"topics":["bun","claude-code","cli","codex","copilot","copilot-api","gateway","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/Vivswan/copilot-env","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vivswan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-04T05:18:29.000Z","updated_at":"2026-06-07T00:14:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Vivswan/copilot-env","commit_stats":null,"previous_names":["vivswan/copilot-env"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Vivswan/copilot-env","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vivswan%2Fcopilot-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vivswan%2Fcopilot-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vivswan%2Fcopilot-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vivswan%2Fcopilot-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vivswan","download_url":"https://codeload.github.com/Vivswan/copilot-env/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vivswan%2Fcopilot-env/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34105565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bun","claude-code","cli","codex","copilot","copilot-api","gateway","typescript"],"created_at":"2026-06-07T02:01:00.267Z","updated_at":"2026-06-13T00:02:09.232Z","avatar_url":"https://github.com/Vivswan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# copilot-env\n\n[![CI](https://github.com/Vivswan/copilot-env/actions/workflows/ci.yml/badge.svg)](https://github.com/Vivswan/copilot-env/actions/workflows/ci.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)\n\nA small, self-bootstrapping CLI that manages a local\n[`@jeffreycao/copilot-api`](https://www.npmjs.com/package/@jeffreycao/copilot-api)\nproxy: start/stop the daemon, wire model aliases, export env vars for your shell\nand for Codex, and report estimated token spend.\n\nTypeScript port of the original Python `copilot-api` helper. Runs on **Linux,\nmacOS, and Windows**.\n\n- **Lifecycle**: `start` / `stop` the local proxy with one command.\n- **Zero setup**: auto-installs [bun](https://bun.sh), dependencies, and the\n  proxy on first run. No global installs to manage.\n- **Shell + Codex wiring**: point your tools at the local proxy automatically;\n  write `~/.codex` config; build a per-host `CODEX_HOME` farm (Linux/macOS).\n- **Cost reporting**: estimated spend from per-host usage DBs via live OpenRouter pricing.\n- **Controlled floating**: the proxy floats to the newest cooldown-aged release\n  within configured bounds; every other dependency is pinned via `bun.lock`.\n\n## Install\n\n```bash\n# macOS / Linux\ncurl -fsSL https://github.com/Vivswan/copilot-env/releases/latest/download/install.sh | bash\n```\n\n```powershell\n# Windows\nirm https://github.com/Vivswan/copilot-env/releases/latest/download/install.ps1 | iex\n```\n\nInstalls bun and copilot-env into `~/.copilot-env`, bootstraps dependencies, then wires your shell.\n\n- **Recommended:** install from the latest GitHub release asset, not from the\n  `main` branch. `main` is for development and can be temporarily ahead of the\n  latest released installer flow.\n- **Artifact:** the installer extracts the official `copilot-env-vX.Y.Z.tar.gz` release asset when present, verifies that asset's SHA256, and checks the archive source marker against GitHub release metadata before extraction.\n- **Replaceable:** re-run the bootstrapper to replace the previous install with the selected release.\n- **Next:** restart your shell, then `agent start`.\n- **Optional:** run `agent shell --clis --launchers` for Claude/Copilot/Codex CLIs and `cl` / `co` / `cx`.\n- **Update later:** `agent update`.\n- **Specific version:** replace `latest` with an exact release tag:\n\n  ```bash\n  curl -fsSL https://github.com/Vivswan/copilot-env/releases/download/v3.0.0/install.sh | bash\n  ```\n\n  ```powershell\n  irm https://github.com/Vivswan/copilot-env/releases/download/v3.0.0/install.ps1 | iex\n  ```\n\n### Install flags\n\n| macOS / Linux | Windows | Effect |\n| --- | --- | --- |\n| `--dir DIR` | `-InstallDir DIR` | Install target (default `~/.copilot-env`; overrides `COPILOT_ENV_DIR`). |\n| `--no-shell-integration` | `-NoShellIntegration` | Don't touch your rc / `$PROFILE`. |\n\n## Usage\n\n```bash\nagent init                 # set up BOTH Codex + Claude (auto-detect direct vs the proxy) + next-step guidance\nagent start                # launch the daemon and sync aliases (--dry-run to preview, --port to pin)\nagent stop                 # stop the daemon\nagent health               # full environment diagnosis (--scope runtime|proxy|setup|codex|claude, --json, --live)\nagent env                  # print shell exports for the calling shell (CODEX_HOME / proxy ANTHROPIC_BASE_URL)\nagent cost                 # estimated token spend across all per-host usage DBs\nagent update               # update to the latest release (--check / --cooldown)\nagent shell                # wire rc / $PROFILE; --launchers adds cl/co/cx, --clis installs the CLIs, --remove unwires\nagent codex                # configure Codex; no flag auto-detects the backend, --check reports it\nagent codex --direct       # force GitHub Copilot Direct (no auto-detect probe)\nagent codex --check        # print provider mode; exits 0 direct, 2 proxy, 1 other\nagent codex --host         # per-host CODEX_HOME symlink farm (Linux/macOS); --delete-host to remove\nagent codex --mobile       # pair the Codex desktop app with the phone remote-control flow (interactive)\nagent claude               # configure Claude; no flag auto-detects the backend, --check reports it\nagent claude --direct      # force GitHub Copilot Direct for Claude (no auto-detect probe)\nagent claude --check       # print Claude provider mode; exits 0 direct, 2 proxy, 1 other\n```\n\nOnce the profile is wired, the same commands run via `agent` on Windows too (or\ndirectly: `powershell -ExecutionPolicy Bypass -File bin\\agent.ps1 \u003ccmd\u003e`).\n\n### Shell integration\n\nThe installer wires the `agent` wrapper into your shell and exports the proxy env.\n\n- **macOS / Linux:** sources `shell/agents.bashrc` from `~/.bashrc` / `~/.zshrc`.\n- **Windows:** dot-sources `shell/agents.ps1` from your PowerShell `$PROFILE`.\n\nThe `cl` / `co` / `cx` launchers are opt-in:\n\n- `cl` runs Claude.\n- `co` runs Copilot.\n- `cx` reads the configured Codex provider (`agent codex --check`), starts the proxy only for proxy-backed configs (re-syncing the port/token), then Codex.\n\nEach has a more-permissive variant that adds the agent's most-relaxed flag: `clx` (`--dangerously-skip-permissions`), `cox` (`--allow-all`), `cxx` (`--sandbox danger-full-access`).\n\nEnable them while installing optional CLIs:\n\n```bash\nagent shell --clis --launchers\n```\n\nOr manage only the launcher block:\n\n```bash\nagent shell --launchers\nagent shell --launchers --remove\n```\n\nManual sourcing is also supported:\n\n```bash\nsource ~/.copilot-env/shell/agents.launchers.bashrc\n```\n\n```powershell\n. ~/.copilot-env/shell/agents.launchers.ps1\n```\n\n### Environment overrides\n\ncopilot-env loads local defaults from root `.env` when running its TypeScript\nentry points; already-set shell environment variables take precedence. The\nproxy float reads these values:\n\n- `COPILOT_API_VERSION=\u003cversion|tag\u003e`: pin the proxy to a specific release\n  (bypasses the floor and cooldown).\n- `COPILOT_API_MIN_RELEASE_AGE=\u003cseconds\u003e`: override the cooldown window\n  (`0` = no cooldown), taking precedence over `bunfig.toml`'s\n  `install.minimumReleaseAge`.\n\nWithout `COPILOT_API_VERSION`, the proxy float reads npm publish times, picks\nthe newest version at least the cooldown window old (`COPILOT_API_MIN_RELEASE_AGE`\nif set, else `bunfig.toml`'s `install.minimumReleaseAge`), and clamps it to the\nbounds in `copilot-env.config`.\n\n## Development\n\nDrive the CLI from a checkout (deps + proxy install in-place; no separate cache):\n\n```bash\ngit clone https://github.com/Vivswan/copilot-env.git\ncd copilot-env\nbash scripts/setup-env.sh   # one-shot env/worktree init (bun install --frozen-lockfile)\n./bin/agent --help          # or: powershell -File bin\\agent.ps1 --help\n```\n\n```bash\nbun run typecheck   # tsc --noEmit\nbun test            # test/**/*.test.ts\nbun run lint        # biome check src bin test scripts\nbun run check       # biome check --write src bin test scripts\n```\n\n- **Env init:** `scripts/setup-env.sh` (`setup-env.ps1` on Windows) is the single\n  initializer; the Copilot coding agent, Codespaces / Dev Containers, and\n  Claude/Codex worktrees all run it.\n- **More docs:** conventions, the proxy float/cooldown model, and a file-by-file\n  breakdown live in [`AGENTS.md`](./AGENTS.md).\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivswan%2Fcopilot-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvivswan%2Fcopilot-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivswan%2Fcopilot-env/lists"}