Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 79 additions & 111 deletions .github/workflows/publish.yml

Large diffs are not rendered by default.

26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,31 @@

Both route to `https://api.llmgateway.io/v1` and send an `x-source: devpass-code` header so DevPass usage is attributed correctly.

### Install & run (from source)
### Install

```bash
curl -fsSL https://raw.githubusercontent.com/theopenco/devpass-code/main/install | bash
```

Or with a package manager:

```bash
npm i -g devpass-code # or: bun / pnpm / yarn
brew install theopenco/tap/devpass-code # macOS & Linux
paru -S devpass-code-bin # Arch Linux (AUR)
```

Run it with Docker:

```bash
docker run -it --rm ghcr.io/theopenco/devpass-code
```

Windows binaries (`devpass-code-windows-*.zip`) are attached to every [GitHub release](https://github.com/theopenco/devpass-code/releases); `npm i -g devpass-code` works there too.

Already installed? Upgrade in place with `devpass-code upgrade`.

### Run from source

```bash
bun install
Expand Down
28 changes: 14 additions & 14 deletions github/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "opencode GitHub Action"
description: "Run opencode in GitHub Actions workflows"
name: "DevPass Code GitHub Action"
description: "Run DevPass Code in GitHub Actions workflows"
branding:
icon: "code"
color: "orange"
Expand Down Expand Up @@ -41,33 +41,33 @@ inputs:
runs:
using: "composite"
steps:
- name: Get opencode version
- name: Get devpass-code version
id: version
shell: bash
run: |
VERSION=$(curl -sf https://api.github.com/repos/anomalyco/opencode/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4)
VERSION=$(curl -sf https://api.github.com/repos/theopenco/devpass-code/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4)
echo "version=${VERSION:-latest}" >> $GITHUB_OUTPUT

- name: Cache opencode
- name: Cache devpass-code
id: cache
uses: actions/cache@v4
with:
path: ~/.opencode/bin
key: opencode-${{ runner.os }}-${{ runner.arch }}-${{ steps.version.outputs.version }}
path: ~/.devpass-code/bin
key: devpass-code-${{ runner.os }}-${{ runner.arch }}-${{ steps.version.outputs.version }}

- name: Install opencode
- name: Install devpass-code
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: curl -fsSL https://opencode.ai/install | bash
run: curl -fsSL https://raw.githubusercontent.com/theopenco/devpass-code/main/install | bash

- name: Add opencode to PATH
- name: Add devpass-code to PATH
shell: bash
run: echo "$HOME/.opencode/bin" >> $GITHUB_PATH
run: echo "$HOME/.devpass-code/bin" >> $GITHUB_PATH

- name: Run opencode
- name: Run devpass-code
shell: bash
id: run_opencode
run: opencode github run
id: run_devpass_code
run: devpass-code github run
env:
MODEL: ${{ inputs.model }}
AGENT: ${{ inputs.agent }}
Expand Down
65 changes: 33 additions & 32 deletions install
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
APP=opencode
APP=devpass-code

MUTED='\033[0;2m'
RED='\033[0;31m'
Expand All @@ -9,7 +9,7 @@ NC='\033[0m' # No Color

usage() {
cat <<EOF
OpenCode Installer
DevPass Code Installer

Usage: install.sh [options]

Expand All @@ -20,9 +20,9 @@ Options:
--no-modify-path Don't modify shell config files (.zshrc, .bashrc, etc.)

Examples:
curl -fsSL https://opencode.ai/install | bash
curl -fsSL https://opencode.ai/install | bash -s -- --version 1.0.180
./install --binary /path/to/opencode
curl -fsSL https://raw.githubusercontent.com/theopenco/devpass-code/main/install | bash
curl -fsSL https://raw.githubusercontent.com/theopenco/devpass-code/main/install | bash -s -- --version 1.0.180
./install --binary /path/to/devpass-code
EOF
}

Expand Down Expand Up @@ -65,7 +65,7 @@ while [[ $# -gt 0 ]]; do
esac
done

INSTALL_DIR=$HOME/.opencode/bin
INSTALL_DIR=$HOME/.devpass-code/bin
mkdir -p "$INSTALL_DIR"

# If --binary is provided, skip all download/detection logic
Expand Down Expand Up @@ -181,8 +181,8 @@ else
fi

if [ -z "$requested_version" ]; then
url="https://github.com/anomalyco/opencode/releases/latest/download/$filename"
specific_version=$(curl -s https://api.github.com/repos/anomalyco/opencode/releases/latest | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p')
url="https://github.com/theopenco/devpass-code/releases/latest/download/$filename"
specific_version=$(curl -s https://api.github.com/repos/theopenco/devpass-code/releases/latest | sed -n 's/.*"tag_name": *"v\([^"]*\)".*/\1/p')

if [[ $? -ne 0 || -z "$specific_version" ]]; then
echo -e "${RED}Failed to fetch version information${NC}"
Expand All @@ -191,14 +191,14 @@ else
else
# Strip leading 'v' if present
requested_version="${requested_version#v}"
url="https://github.com/anomalyco/opencode/releases/download/v${requested_version}/$filename"
url="https://github.com/theopenco/devpass-code/releases/download/v${requested_version}/$filename"
specific_version=$requested_version

# Verify the release exists before downloading
http_status=$(curl -sI -o /dev/null -w "%{http_code}" "https://github.com/anomalyco/opencode/releases/tag/v${requested_version}")
http_status=$(curl -sI -o /dev/null -w "%{http_code}" "https://github.com/theopenco/devpass-code/releases/tag/v${requested_version}")
if [ "$http_status" = "404" ]; then
echo -e "${RED}Error: Release v${requested_version} not found${NC}"
echo -e "${MUTED}Available releases: https://github.com/anomalyco/opencode/releases${NC}"
echo -e "${MUTED}Available releases: https://github.com/theopenco/devpass-code/releases${NC}"
exit 1
fi
fi
Expand All @@ -219,11 +219,11 @@ print_message() {
}

check_version() {
if command -v opencode >/dev/null 2>&1; then
opencode_path=$(which opencode)
if command -v devpass-code >/dev/null 2>&1; then
devpass_code_path=$(which devpass-code)

## Check the installed version
installed_version=$(opencode --version 2>/dev/null || echo "")
installed_version=$(devpass-code --version 2>/dev/null || echo "")

if [[ "$installed_version" != "$specific_version" ]]; then
print_message info "${MUTED}Installed version: ${NC}$installed_version."
Expand Down Expand Up @@ -275,7 +275,7 @@ download_with_progress() {
fi

local tmp_dir=${TMPDIR:-/tmp}
local basename="${tmp_dir}/opencode_install_$$"
local basename="${tmp_dir}/devpass-code_install_$$"
local tracefile="${basename}.trace"

rm -f "$tracefile"
Expand Down Expand Up @@ -325,8 +325,8 @@ download_with_progress() {
}

download_and_install() {
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}version: ${NC}$specific_version"
local tmp_dir="${TMPDIR:-/tmp}/opencode_install_$$"
print_message info "\n${MUTED}Installing ${NC}devpass-code ${MUTED}version: ${NC}$specific_version"
local tmp_dir="${TMPDIR:-/tmp}/devpass-code_install_$$"
mkdir -p "$tmp_dir"

if [[ "$os" == "windows" ]] || ! [ -t 2 ] || ! download_with_progress "$url" "$tmp_dir/$filename"; then
Expand All @@ -340,15 +340,15 @@ download_and_install() {
unzip -q "$tmp_dir/$filename" -d "$tmp_dir"
fi

mv "$tmp_dir/opencode" "$INSTALL_DIR"
chmod 755 "${INSTALL_DIR}/opencode"
mv "$tmp_dir/devpass-code" "$INSTALL_DIR"
chmod 755 "${INSTALL_DIR}/devpass-code"
rm -rf "$tmp_dir"
}

install_from_binary() {
print_message info "\n${MUTED}Installing ${NC}opencode ${MUTED}from: ${NC}$binary_path"
cp "$binary_path" "${INSTALL_DIR}/opencode"
chmod 755 "${INSTALL_DIR}/opencode"
print_message info "\n${MUTED}Installing ${NC}devpass-code ${MUTED}from: ${NC}$binary_path"
cp "$binary_path" "${INSTALL_DIR}/devpass-code"
chmod 755 "${INSTALL_DIR}/devpass-code"
}

if [ -n "$binary_path" ]; then
Expand All @@ -366,9 +366,9 @@ add_to_path() {
if grep -Fxq "$command" "$config_file"; then
print_message info "Command already exists in $config_file, skipping write."
elif [[ -w $config_file ]]; then
echo -e "\n# opencode" >> "$config_file"
echo -e "\n# devpass-code" >> "$config_file"
echo "$command" >> "$config_file"
print_message info "${MUTED}Successfully added ${NC}opencode ${MUTED}to \$PATH in ${NC}$config_file"
print_message info "${MUTED}Successfully added ${NC}devpass-code ${MUTED}to \$PATH in ${NC}$config_file"
else
print_message warning "Manually add the directory to $config_file (or similar):"
print_message info " $command"
Expand Down Expand Up @@ -444,17 +444,18 @@ if [ -n "${GITHUB_ACTIONS-}" ] && [ "${GITHUB_ACTIONS}" == "true" ]; then
fi

echo -e ""
echo -e "${MUTED}  ${NC} ▄ "
echo -e "${MUTED}█▀▀█ █▀▀█ █▀▀█ █▀▀▄ ${NC}█▀▀▀ █▀▀█ █▀▀█ █▀▀█"
echo -e "${MUTED}█░░█ █░░█ █▀▀▀ █░░█ ${NC}█░░░ █░░█ █░░█ █▀▀▀"
echo -e "${MUTED}▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ${NC}▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"
echo -e "${MUTED} ▄ ${NC} ▄ "
echo -e "${MUTED}█▀▀█ █▀▀█ █░░█ █▀▀█ █▀▀█ █▀▀▀ █▀▀▀ ${NC}█▀▀▀ █▀▀█ █▀▀█ █▀▀█"
echo -e "${MUTED}█░░█ █▀▀▀ █░░█ █░░█ █▀▀█ ▀▀▀█ ▀▀▀█ ${NC}█░░░ █░░█ █░░█ █▀▀▀"
echo -e "${MUTED}▀▀▀▀ ▀▀▀▀ ▀▀ █▀▀▀ █░░█ ▀▀▀▀ ▀▀▀▀ ${NC}▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀"
echo -e ""
echo -e ""
echo -e "${MUTED}OpenCode includes free models, to start:${NC}"
echo -e "${MUTED}DevPass Code runs on LLM Gateway, to start:${NC}"
echo -e ""
echo -e "cd <project> ${MUTED}# Open directory${NC}"
echo -e "opencode ${MUTED}# Run command${NC}"
echo -e "cd <project> ${MUTED}# Open directory${NC}"
echo -e "devpass-code auth login ${MUTED}# Connect to LLM Gateway${NC}"
echo -e "devpass-code ${MUTED}# Run command${NC}"
echo -e ""
echo -e "${MUTED}For more information visit ${NC}https://opencode.ai/docs"
echo -e "${MUTED}For more information visit ${NC}https://llmgateway.io"
echo -e ""
echo -e ""
8 changes: 4 additions & 4 deletions packages/devpass-code/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ ENV BUN_RUNTIME_TRANSPILER_CACHE_PATH=${BUN_RUNTIME_TRANSPILER_CACHE_PATH}
RUN apk add libgcc libstdc++ ripgrep

FROM base AS build-amd64
COPY dist/opencode-linux-x64-baseline-musl/bin/opencode /usr/local/bin/opencode
COPY dist/devpass-code-linux-x64-baseline-musl/bin/devpass-code /usr/local/bin/devpass-code

FROM base AS build-arm64
COPY dist/opencode-linux-arm64-musl/bin/opencode /usr/local/bin/opencode
COPY dist/devpass-code-linux-arm64-musl/bin/devpass-code /usr/local/bin/devpass-code

ARG TARGETARCH
FROM build-${TARGETARCH}
RUN opencode --version
ENTRYPOINT ["opencode"]
RUN devpass-code --version
ENTRYPOINT ["devpass-code"]
10 changes: 5 additions & 5 deletions packages/devpass-code/bin/devpass-code
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ function run(target) {
})
}

const envPath = process.env.OPENCODE_BIN_PATH
const envPath = process.env.DEVPASS_CODE_BIN_PATH || process.env.OPENCODE_BIN_PATH

const scriptPath = fs.realpathSync(__filename)
const scriptDir = path.dirname(scriptPath)

//
const cached = path.join(scriptDir, ".opencode")
const cached = path.join(scriptDir, ".devpass-code")

const platformMap = {
darwin: "darwin",
Expand All @@ -70,8 +70,8 @@ let arch = archMap[os.arch()]
if (!arch) {
arch = os.arch()
}
const base = "opencode-" + platform + "-" + arch
const binary = platform === "windows" ? "opencode.exe" : "opencode"
const base = "devpass-code-" + platform + "-" + arch
const binary = platform === "windows" ? "devpass-code.exe" : "devpass-code"

function supportsAvx2() {
if (arch !== "x64") return false
Expand Down Expand Up @@ -189,7 +189,7 @@ function findBinary(startDir) {
const resolved = envPath || (fs.existsSync(cached) ? cached : findBinary(scriptDir))
if (!resolved) {
console.error(
"It seems that your package manager failed to install the right version of the opencode CLI for your platform. You can try manually installing " +
"It seems that your package manager failed to install the right version of the devpass-code CLI for your platform. You can try manually installing " +
names.map((n) => `\"${n}\"`).join(" or ") +
" package",
)
Expand Down
2 changes: 1 addition & 1 deletion packages/devpass-code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dev:temporary": "bun run --conditions=browser ./src/temporary.ts"
},
"bin": {
"devpass-code": "./bin/opencode"
"devpass-code": "./bin/devpass-code"
},
"exports": {
"./*": "./src/*.ts"
Expand Down
6 changes: 3 additions & 3 deletions packages/devpass-code/script/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ for (const item of targets) {
autoloadTsconfig: true,
autoloadPackageJson: true,
target: name.replace(pkg.name, "bun") as any,
outfile: `dist/${name}/bin/opencode`,
execArgv: [`--user-agent=opencode/${Script.version}`, "--use-system-ca", "--"],
outfile: `dist/${name}/bin/${pkg.name}`,
execArgv: [`--user-agent=${pkg.name}/${Script.version}`, "--use-system-ca", "--"],
windows: {},
},
files: embeddedFileMap ? { "opencode-web-ui.gen.ts": embeddedFileMap } : {},
Expand All @@ -200,7 +200,7 @@ for (const item of targets) {

// Smoke test: only run if binary is for current platform
if (item.os === process.platform && item.arch === process.arch && !item.abi) {
const binaryPath = `dist/${name}/bin/opencode`
const binaryPath = `dist/${name}/bin/${pkg.name}`
console.log(`Running smoke test: ${binaryPath} --version`)
try {
const versionOutput = await $`${binaryPath} --version`.text()
Expand Down
10 changes: 5 additions & 5 deletions packages/devpass-code/script/postinstall.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const archMap = {

const platform = platformMap[os.platform()] ?? os.platform()
const arch = archMap[os.arch()] ?? os.arch()
const base = `opencode-${platform}-${arch}`
const sourceBinary = platform === "windows" ? "opencode.exe" : "opencode"
const targetBinary = path.join(__dirname, "bin", "opencode.exe")
const base = `devpass-code-${platform}-${arch}`
const sourceBinary = platform === "windows" ? "devpass-code.exe" : "devpass-code"
const targetBinary = path.join(__dirname, "bin", "devpass-code.exe")

function supportsAvx2() {
if (arch !== "x64") return false
Expand Down Expand Up @@ -127,7 +127,7 @@ function installPackage(name) {
const version = packageJson.optionalDependencies?.[name]
if (!version) return

const temp = fs.mkdtempSync(path.join(os.tmpdir(), "opencode-install-"))
const temp = fs.mkdtempSync(path.join(os.tmpdir(), "devpass-code-install-"))
try {
const result = childProcess.spawnSync(
"npm",
Expand Down Expand Up @@ -175,7 +175,7 @@ function main() {
}

throw new Error(
`It seems your package manager failed to install the right opencode CLI package. Try manually installing ${packageNames()
`It seems your package manager failed to install the right devpass-code CLI package. Try manually installing ${packageNames()
.map((name) => JSON.stringify(name))
.join(" or ")}.`,
)
Expand Down
Loading
Loading