# -*- 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.1.15
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  699b37b7b5dd8781c041fae165294438133424484246d65b7eb10f0b22be7c18 \
                    rmd160  8fc14c3e51b1557d2e8d72b471004cc2a4f00943 \
                    size    286808

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.
"
