diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..f7fd041 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,22 @@ +name: Publish package + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org + - run: npm publish --access public --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a9b771d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Pat Woz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..dd51c92 --- /dev/null +++ b/README.md @@ -0,0 +1,92 @@ +# pi-commandcode-provider + +A [pi](https://github.com/badlogic/pi-mono) custom provider that connects pi to the [Command Code](https://commandcode.ai) API. + +> **Note:** This package only provides a model *provider*. It does **not** include an API key. You must bring your own Command Code API key or subscription. + +## Models + +18 models across premium and open-source providers: + +| Category | Models | +|----------|--------| +| **Anthropic** | Claude Opus 4.7, Claude Opus 4.6, Claude Sonnet 4.6, Claude Haiku 4.5 | +| **OpenAI** | GPT-5.5, GPT-5.4, GPT-5.3 Codex, GPT-5.4 Mini | +| **Open-source** | DeepSeek V4 Pro, DeepSeek V4 Flash, Kimi K2.6, Kimi K2.5, GLM-5.1, GLM-5, MiniMax M2.7, MiniMax M2.5, Qwen 3.6 Max, Qwen 3.6 Plus | + +## Install + +```sh +pi install npm:pi-commandcode-provider +``` + +Or shorthand: + +```sh +pi install pi-commandcode-provider +``` + +Then reload pi: + +```txt +/reload +``` + +## Setup + +Set your Command Code API key using one of these methods: + +### 1. Environment variable + +```sh +export COMMANDCODE_API_KEY="cc-..." +``` + +### 2. Auth file (recommended) + +Create `~/.commandcode/auth.json`: + +```json +{ + "apiKey": "cc-..." +} +``` + +Or use pi's auth file at `~/.pi/agent/auth.json`: + +```json +{ + "commandcode": "cc-..." +} +``` + +## Usage + +After installing and setting your API key, select a Command Code model in pi: + +```txt +/model claude-sonnet-4-6 +``` + +Any query will then use the Command Code API. You can list available models: + +```sh +pi -e index.ts --list-models +``` + +Or within pi: + +```txt +/models +``` + +## Publish + +```sh +npm login +npm publish --access public +``` + +## License + +MIT diff --git a/package.json b/package.json index 5e2d399..625ddc2 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,19 @@ "provider" ], "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/patlux/pi-commandcode-provider.git" + }, + "homepage": "https://github.com/patlux/pi-commandcode-provider#readme", + "bugs": { + "url": "https://github.com/patlux/pi-commandcode-provider/issues" + }, + "files": [ + "index.ts", + "README.md", + "LICENSE" + ], "scripts": { "test": "npm run typecheck && tsx tests/test-pure-functions.ts && tsx tests/test-abort.ts && tsx tests/test-stream.ts && node tests/test-pi-local.mjs", "typecheck": "tsc --noEmit --target ES2022 --module NodeNext --moduleResolution NodeNext --allowImportingTsExtensions --skipLibCheck --types node src/core.ts tests/*.ts",