# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           npm 1.0

name                opencode
version             2.0.16
revision            0

categories          llm
platforms           {darwin any >= 19}
maintainers         {oakimov @oakimov} openmaintainer
license             MIT
supported_archs     x86_64 arm64

description         OpenCode, an open source AI coding agent
long_description    OpenCode is an open source AI coding agent. This port \
                    tracks the OpenCode 2.x line.\
                    \n\
                    \n- Terminal-based interface for AI-assisted coding\
                    \n- Built-in support for many LLM providers via /connect\
                    \n- Configurable agents, models, skills, tools, and themes\
                    \n- Extensible with plugins, MCP servers, and custom commands\
                    \n\
                    \nMigration from 1.x: https://opencode.ai/v2/docs/migrate-v1/

homepage            https://opencode.ai/v2/docs

npm.rootname        @opencode/cli
distname            cli-${version}

checksums           rmd160  239c2a9c91ce4b122dd3a110188e7addc8bd313e \
                    sha256  bea46ec5702c4d6b7b691da523b6fc5f7e37c9b3a56cfca81b8ee849a2ef7f4a \
                    size    2414

conflicts           opencode1

# @opencode/cli also ships an opencode2 binary; keep only the unversioned name.
post-destroot {
    delete ${destroot}${prefix}/bin/opencode2
}

notes \
"OpenCode 2.x is not a drop-in replacement for 1.x. Upgrading requires a \
migration of plugins and configuration:\
\n\
\n    https://opencode.ai/v2/docs/migrate-v1/\
\n\
\nIf you rely on OpenCode 1.x plugins, use opencode1 instead:\
\n\
\n    sudo port uninstall opencode\
\n    sudo port install opencode1"
