Skip to content

Publishing Guide

This guide covers how to publish packages to npm for the agent-detective monorepo.

The root agent-detective app is "private": true and is not published to npm. Publish workspace packages under packages/ (via Changesets) as needed.

PackageDescription
@agent-detective/typesShared TypeScript types
@agent-detective/coreOpenAPI / HTTP controller helpers
@agent-detective/observabilityLogging, metrics, health
@agent-detective/process-utilsProcess / shell helpers
@agent-detective/local-repos-pluginLocal repo + matcher plugin
@agent-detective/jira-adapterJira adapter plugin
  1. npm account with appropriate organization access
  2. pnpm installed: npm install -g pnpm
  3. 2FA enabled on your npm account (recommended)
  4. Clean git state with all changes committed
  • All tests pass: pnpm run test
  • TypeScript check passes: pnpm run typecheck
  • Build succeeds: pnpm run build
  • Git working directory is clean
  • Version numbers updated

This monorepo uses Changesets for version management.

Terminal window
# 1. Ensure clean state
git status # Should show clean working directory
# 2. Run pre-release checks
pnpm run test
pnpm run typecheck
pnpm run lint
pnpm run build
# 3. Create a changeset (describe what changed)
pnpm changeset
# 4. Apply version bumps (updates package.json files)
pnpm changeset version
# 5. Build with new versions
pnpm run build
# 6. Commit version changes
git add -A
git commit -m "chore: release vX.Y.Z"
git push
# 7. Publish packages
pnpm publish -r --access public

When you run pnpm changeset, it creates a file in .changeset/ with this format:

---
"@agent-detective/types": patch
"@agent-detective/jira-adapter": minor
---
Description of changes

Version types:

  • patch - Bug fixes (1.0.0 → 1.0.1)
  • minor - New features (1.0.0 → 1.1.0)
  • major - Breaking changes (1.0.0 → 2.0.0)
Terminal window
# Create changeset for specific package
echo '{"changesets":[]}' > .changeset/skip-versioning.md
pnpm changeset add --empty
# Or manually edit version in package.json
cd packages/types
pnpm version patch
cd ../..
pnpm run build
cd packages/types && pnpm publish --access public

We follow Semantic Versioning:

  • MAJOR (1.0.0 → 2.0.0): Breaking changes to types or APIs
  • MINOR (1.0.0 → 1.1.0): New types, new plugin features (backward compatible)
  • PATCH (1.0.0 → 1.0.1): Bug fixes, documentation updates
@agent-detective/typesagent-detective
1.x0.x
2.x1.x (when released)

Wiring a published or private package into a running app (plugins in config, Docker volume paths, pnpm in the app root) is covered in extending-with-plugins.md. Below: @agent-detective/types and publish mechanics.

Terminal window
npm install @agent-detective/types
# or
pnpm add @agent-detective/types
import type { Plugin, PluginContext, TaskEvent } from '@agent-detective/types';
const myPlugin: Plugin = {
name: '@myorg/my-adapter',
version: '1.0.0',
schemaVersion: '1.0',
schema: {
type: 'object',
properties: {
enabled: { type: 'boolean', default: true },
},
required: [],
},
register(app, context: PluginContext) {
// context.agentRunner, context.repoMapping, etc.
}
};
export default myPlugin;

Within the monorepo, packages use workspace:* for dependencies:

packages/jira-adapter/package.json
{
"dependencies": {
"@agent-detective/types": "workspace:*"
}
}

When published to npm, pnpm automatically replaces workspace:* with the actual version.

”You must be logged in to publish packages"

Section titled “”You must be logged in to publish packages"”
Terminal window
npm login
# or
pnpm login

"You need to authorize this package for public access"

Section titled “"You need to authorize this package for public access"”
Terminal window
# First time publishing a new scope
npm org add @agent-detective your-username

Check that dist/index.js and dist/index.d.ts exist in the published package.

Terminal window
# Clear pnpm cache
pnpm store prune
pnpm install

For automated releases, consider:

  1. Using GitHub Actions to run tests and builds
  2. Using release-please or similar for automated version bumps
  3. Adding npm tokens as GitHub Secrets

Example GitHub Action workflow:

name: Release
on:
push:
tags:
- 'v*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- run: pnpm install --frozen-lockfile
- run: pnpm run test
- run: pnpm run build
- run: pnpm publish -r --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

If you need to unpublish a version:

Terminal window
# Unpublish specific version
npm unpublish @agent-detective/types@1.0.1
# Unpublish entire package (use with caution)
npm unpublish @agent-detective/types --force

Note: You cannot unpublish a version if another package depends on it.


The agent-detective Docker image is published to GitHub Container Registry (ghcr.io).

ItemValue
Registryghcr.io
Organizationtoniop99
Repositoryagent-detective
VisibilityPublic
TagDescriptionUpdated
latestLatest build from main branchEvery push to main
stableLatest releaseOn version tag
1, 1.0, 1.0.0Version-specific tagsOn version tag

The repository includes two workflows:

  • Trigger: Push to main branch
  • Action: Builds and pushes Docker image with latest tag
  • Platforms: linux/amd64, linux/arm64
  • Trigger: Push of tag v*.*.*
  • Action: Builds and pushes Docker image with all version tags
  • Platforms: linux/amd64, linux/arm64
Terminal window
# Build locally
docker build --target production \
--build-arg AGENTS="opencode,claude" \
-t ghcr.io/toniop99/agent-detective:latest .
# Login to ghcr.io
echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
# Push
docker push ghcr.io/toniop99/agent-detective:latest
Terminal window
# Create a version tag
git tag v1.0.0
git push origin v1.0.0
# This triggers release.yml which:
# 1. Builds the image
# 2. Pushes with tags: latest, stable, 1, 1.0, 1.0.0
# 3. Creates a GitHub Release

Build arguments control which agents are installed:

Terminal window
# Build with default agents (opencode only)
docker build --target production -t agent-detective .
# Build with multiple agents
docker build --target production \
--build-arg AGENTS="opencode,claude" \
-t agent-detective:multi .
# Available agents for AGENTS build-arg: opencode, claude (npm global).
# Cursor Agent CLI (in-app id: cursor) is not installed via npm; see ../development/cursor-agent.md.
ghcr.io/toniop99/agent-detective:latest
├── dist/ # Built application
├── config/ # Default config
├── plugins/ # Third-party plugins (volume mount)
│ └── .gitkeep
└── node_modules/ # Dependencies + bundled plugins
Terminal window
# Latest
docker pull ghcr.io/toniop99/agent-detective:latest
# Specific version
docker pull ghcr.io/toniop99/agent-detective:1.0.0
# Stable
docker pull ghcr.io/toniop99/agent-detective:stable