Skip to content

Latest commit

聽

History

History
89 lines (60 loc) 路 2.87 KB

CONTRIBUTING.md

File metadata and controls

89 lines (60 loc) 路 2.87 KB

Development and Maintenance

See the main CONTRIBUTING.md to learn how to contribute to Langfuse and its integrations.

Local Development

Install dependencies:

pnpm install

Build the plugin:

pnpm run build

To test the plugin globally, add its combined built entrypoint to ~/.config/opencode/opencode.jsonc. Replace /path/to/langfuse-opencode with the absolute path to this repository. The same entrypoint supports OpenCode 1.18.29 and newer and OpenCode 2.

For OpenCode 2:

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["/path/to/langfuse-opencode/dist/index.js"],
}

For OpenCode 1:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["/path/to/langfuse-opencode/dist/index.js"],
}

Rebuild the package after making changes and restart OpenCode before testing:

pnpm run build
opencode service restart

Format files:

pnpm run format

Check formatting:

pnpm run format:check

tsdown bundles the combined plugin and its runtime dependencies into dist/index.js. OpenCode 1 calls its server() implementation and OpenCode 2 calls its setup() implementation. Version-specific entrypoints remain available at dist/v1/index.js and dist/v2/index.js. Do not edit generated files in dist/ by hand.

Releasing

  1. From a clean, up-to-date main branch, bump the version and push the resulting commit and tag:

    pnpm version 1.2.3 --message "Release v%s"
    git push origin main --follow-tags

    pnpm version updates package.json, creates a commit titled Release v1.2.3, and tags it as v1.2.3. The release workflow runs on pushes to main and skips commits without a matching version tag. For tagged release commits, it builds and tests the package, stages it on npm with provenance, and creates a draft GitHub release.

    If the tag was pushed separately, manually run the Release workflow with main selected. The tag matching package.json must point to the selected main commit. Manual runs fail if that tag is missing or points elsewhere.

  2. Review the staged package on npmjs.com or with the npm CLI:

    npm stage list @langfuse/opencode-observability-plugin
    npm stage view <stage-id>
    npm stage download <stage-id>
  3. Approve the staged package using an npm account with publish access and 2FA enabled:

    npm stage approve <stage-id>
  4. Review and publish the draft GitHub release created by the workflow.

Do not approve the npm package or publish the GitHub draft until both staged artifacts have been reviewed. If the workflow fails before staging, fix the problem and move the tag to the corrected release commit. If staging succeeded, do not rerun the workflow with the same version; staged and published versions cannot be staged again.