# -*- 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-dcp
version             3.2.0
revision            0
categories          llm
platforms           {darwin any >= 19}
maintainers         nomaintainer
license             GPL-3
supported_archs     noarch

description         Dynamic Context Pruning plugin for the OpenCode agent
long_description    DCP is an OpenCode plugin that reduces token usage by pruning \
                    obsolete tool outputs from the conversation context before it \
                    is sent to the model, via automatic deduplication and an \
                    AI-assisted compress tool. It has no command-line interface of \
                    its own: OpenCode loads it in-process through OpenCode's own \
                    plugin config (opencode.jsonc). Installing this port gives you \
                    a MacPorts-managed, version-pinned copy to point OpenCode at, \
                    instead of letting OpenCode fetch @latest from the npm registry \
                    itself on every start.

homepage            https://github.com/Opencode-DCP/opencode-dynamic-context-pruning

# scoped package
npm.rootname        @tarquinen/opencode-dcp
distname            opencode-dcp-${version}

checksums           sha256  6e62c02324a2fac61be4ed6d1a37dc16090476a449a7367b3d2ba7955d9bf1db \
                    rmd160  65e03df923869d6831a1b73e23f54c81bd6fe13e \
                    size    314977

notes "${name} is an in-process OpenCode plugin, not a CLI tool: it has no\
    \`bin\` entry, so this installs under\
    ${prefix}/lib/node_modules/@tarquinen/opencode-dcp without adding\
    anything to PATH. Point OpenCode at the installed copy by editing\
    opencode.jsonc (global: ~/.config/opencode/opencode.jsonc, or project:\
    ./.opencode/opencode.jsonc):

        // https://github.com/Opencode-DCP/opencode-dynamic-context-pruning
        \"plugin\": \[
            \"${prefix}/lib/node_modules/@tarquinen/opencode-dcp/dist/index.js\"
        \],

    This replaces the npm spec, which OpenCode would otherwise resolve itself\
    at every start regardless of what MacPorts has installed. From here,\
    bumping this port's version and checksums and running\
    'port upgrade opencode-dcp' is how you control which release you're\
    running, in place of an automatic @latest pull.
"
