.agents/skills/vendor-otel/SKILL.md
Input: The npm package name to vendor (e.g., @opentelemetry/instrumentation-graphql).
Copy upstream OTel instrumentation TypeScript source into a vendored/ directory, remove the npm dependency, and ensure builds and tests pass. No logic changes — the vendored code must behave identically to the original.
Find upstream source files:
gh api "repos/open-telemetry/opentelemetry-js-contrib/git/trees/main?recursive=1" --jq '.tree[].path' | grep "instrumentation-<name>/src/.*\.ts$"
Check versions:
grep "instrumentation-<name>" packages/node/package.jsongh api repos/open-telemetry/opentelemetry-js-contrib/git/refs/tags --jq '.[].ref' | grep "instrumentation-<name>"gh api repos/open-telemetry/opentelemetry-js-contrib/git/refs/tags/instrumentation-<name>-v<version> --jq '.object.sha'Review the upstream CHANGELOG between pinned and latest version:
https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/packages/instrumentation-<name>/CHANGELOG.md
Fetch and present the relevant changelog entries to the user. All OTel instrumentations are pre-v1 so any bump could introduce breaking changes.
Also diff ALL source files between pinned and latest version. Report both the changelog and diff findings to the user so they can verify the bump is safe before proceeding.
Check for external type imports (these need special handling, see section 5):
grep "import.*from '" <file> | grep -v "@opentelemetry\|'\./\|@sentry\|'util'\|'path'\|'fs'\|'http'\|'events'"
Check test coverage and report gaps:
dev-packages/node-integration-tests/suites/tracing/<name>/dev-packages/e2e-tests/test-applications/node-<name>/packages/node/test/integrations/tracing/<name>.test.tsPresent a plan to the user covering:
Stop here and wait for explicit user approval before implementing. Use AskUserQuestion to confirm the plan.
packages/node/src/integrations/tracing/<name>.ts → packages/node/src/integrations/tracing/<name>/index.tsfs.ts): packages/node/src/integrations/<name>/index.tsvendored/ subdirectory for upstream filesFetch original TypeScript from the OTel contrib GitHub repo (NOT compiled JS from node_modules):
gh api "repos/open-telemetry/opentelemetry-js-contrib/contents/<path>?ref=<tag>" --jq '.content' | base64 -d
When stripping the upstream SPDX header, verify all import lines are still present afterward.
Each vendored file gets the full Apache 2.0 license header plus:
* NOTICE from the Sentry authors:
* - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/<sha>/packages/instrumentation-<name>
* - Upstream version: @opentelemetry/instrumentation-<name>@<version>
Add bullets for TS adjustments or type vendoring only when applicable.
Append /* eslint-disable */ after the header block.
Standard replacements in the main instrumentation file:
import { PACKAGE_NAME, PACKAGE_VERSION } from './version'import { SDK_VERSION } from '@sentry/core' and const PACKAGE_NAME = '@sentry/instrumentation-<name>';PACKAGE_VERSION with SDK_VERSION in the super() callInclude barrel exports (enums/index.ts, etc.) if the upstream has them.
Always inline types from external packages — including types from the instrumented package itself. Without inlining, the local SDK build relies on workspace hoisting to resolve these types, which is brittle.
types.ts already vendors some types inline.import type * as X from '<external-package>', inline simplified types:
<package>-types.ts file in vendored/[key: string]: any index signatures for permissivenessgrep "from '<package>'" packages/node/build/types/...Fix any compilation errors caused by this repository's strict TypeScript settings (strict: true, noUncheckedIndexedAccess: true). Add a Minor TypeScript strictness adjustments bullet to the header when changes are made.
package.json@opentelemetry/core) that isn't a direct dependency, add it — rollup auto-externalizes based on dependencies.oxlintrc.base.jsonyarn install
yarn fix
yarn build:dev:filter @sentry/<package>
Verify no external types leak into .d.ts output.
Run existing tests:
cd dev-packages/node-integration-tests && yarn test suites/tracing/<name>cd packages/node && yarn test:unit test/integrations/tracing/<name>.test.tsUpdate unit test imports from @opentelemetry/instrumentation-<name> to the vendored path, including vi.mock() calls.
Before submitting, report ALL modifications to the user:
After reporting changes, ask the user if they want to proceed with creating the draft PR. Use AskUserQuestion to confirm.
vendor-<name>-instrumentationref(node): Vendor <name> instrumentationdevelop