Publishing

Publish your Trik to the TrikHub registry so others can find and install it.

Prerequisites

Before publishing, make sure you have:

  • Logged in with trik login (authenticates via GitHub)
  • A public GitHub repository with your Trik code pushed
  • manifest.json with the correct version field
  • trikhub.json at the repo root with registry metadata (including repository URL)
  • dist/ directory committed to git (TypeScript only) — compiled JavaScript output must be in the repo. Python triks do not need dist/.

Validating with trik lint

Before publishing, validate your Trik locally:

trik lint .

This checks:

  • Manifest structure and required fields
  • TDPS rules (e.g., outputSchema uses agent-safe types)
  • Entry point file exists at the declared path

Publishing runs this same validation automatically, but linting first helps catch issues early.

You can also treat warnings as errors:

trik lint . --warnings-as-errors

Publishing Flow

1. Set the version in manifest.json

{ "version": "1.0.0" }

2. Commit and push all code to GitHub

Make sure dist/ is committed (not in .gitignore):

# TypeScript: build first npm run build git add . git commit -m "v1.0.0" git push

Python triks skip the build step — source files are loaded directly.

3. Create a git tag matching the version

The tag must follow the format v{version}:

git tag v1.0.0

4. Push the tag to GitHub

git push origin v1.0.0

5. Run trik publish

From your project root:

trik publish

The CLI will:

  1. Validate your Trik using the linter
  2. Read manifest.json for the version
  3. Read trikhub.json for the repository URL
  4. Verify the git tag v1.0.0 exists on the remote
  5. Extract the commit SHA the tag points to
  6. Register the Trik and version with the registry

Updating a Version

Same flow — update the version, tag, and publish:

# 1. Make your changes # 2. Update version in manifest.json to "1.1.0" # 3. Commit and push git add . git commit -m "v1.1.0" git push # 4. Create and push a new tag git tag v1.1.0 git push origin v1.1.0 # 5. Publish trik publish

Each version is published independently. Previous versions remain available.

Unpublishing

To permanently remove a Trik from the registry:

trik unpublish @yourname/my-trik

This removes the Trik and all its versions. Users who already installed it keep their local copy, but no new installations will be possible.

Troubleshooting

Tag not found on remote

Error: Tag v1.0.0 not found on remote

Make sure you pushed the tag: git push origin v1.0.0. The tag must exist on the remote, not just locally.

Git remote does not match trikhub.json repository

Repository mismatch detected: trikhub.json: https://github.com/owner/repo git remote: git@github.com:other/repo.git

The repository URL in trikhub.json must match your git remote origin. Update one or the other to match.

dist/ not committed

TypeScript only. Python triks do not need a dist/ directory.

If your compiled output isn’t in git, the registry won’t be able to access it. Make sure dist/ is not in .gitignore and is committed:

git add dist/ git commit -m "Add compiled output" git push

Not a git repository

Publishing requires a git repository with a remote. Initialize one if needed:

git init git remote add origin https://github.com/yourusername/my-trik