youtrack-cli

module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT

README

ytrack

An unofficial command-line interface for JetBrains YouTrack, in the style of gh and glab. Not affiliated with or endorsed by JetBrains.

Status: early. This release covers authentication, the raw ytrack api command, reading, creating, editing and commenting on issues, YouTrack commands on one or many issues, time tracking (work items), and an agent skill that teaches coding agents to use ytrack.

Install

Linux and macOS, no package manager or sudo needed (installs to ~/.local/bin):

curl -fsSL https://raw.githubusercontent.com/BrainerVirus/youtrack-cli/main/install.sh | sh

Windows (PowerShell; installs to %LOCALAPPDATA%\Programs\ytrack):

irm https://raw.githubusercontent.com/BrainerVirus/youtrack-cli/main/install.ps1 | iex

Both scripts pick the archive for your OS and CPU, check its SHA-256 against the release's checksums file, check that file's cosign signature when cosign is installed, and print a hint if the install directory is not on your PATH. install.sh also installs shell completions for zsh, bash or fish. YTRACK_VERSION=v0.3.0 installs a given release and YTRACK_INSTALL_DIR changes the directory. See docs/install.md.

Homebrew (macOS and Linux):

brew install brainervirus/tap/ytrack

With Go:

go install github.com/BrainerVirus/youtrack-cli/cmd/ytrack@latest

Or download an archive for your platform (Linux, macOS, Windows; amd64 or arm64) from the releases page, unpack it and put ytrack on your PATH. Archives also contain shell completions for bash, zsh and fish. Each release has a ytrack_<version>_checksums.txt with SHA-256 sums, signed with cosign by the release workflow; docs/install.md shows how to check both.

Or build from a clone with make build (binary in bin/ytrack).

More: docs/install.md covers the install scripts and their options, verifying a download, upgrades and the new-release notice.

Upgrade

ytrack upgrade                 # to the latest release
ytrack upgrade --check         # only say whether a newer release exists
ytrack upgrade --version v0.3.0

ytrack upgrade replaces the running binary only after the release's checksums file passes a cosign keyless signature check pinned to this repository's release workflow and the archive matches its SHA-256; any mismatch refuses and changes nothing. If Homebrew, Scoop or WinGet installed ytrack, it prints that package manager's upgrade command instead.

Once a day, after a command, ytrack tells you on stderr when a newer release exists. It stays quiet in CI, when stderr is not a terminal and under --json; turn it off with YTRACK_NO_UPDATE_NOTIFIER=1 or check_update: false in config.yml. Details: docs/install.md.

Log in

ytrack auth login

ytrack asks for your YouTrack URL (acme.youtrack.cloud, or a Server URL such as https://tools.acme.com/youtrack) and opens your profile's Account Security tab. Create a permanent token named ytrack with the scope YouTrack and paste it at the hidden prompt. If your Server uses an external Hub, ytrack links to the token docs instead.

Scripted:

ytrack auth login --host acme.youtrack.cloud --with-token < token.txt

The token is checked against /api/users/me and saved in the OS keyring (macOS Keychain, Windows Credential Manager, Secret Service on Linux). With no keyring, login fails unless you pass --insecure-storage, which writes credentials.yml (mode 0600) in the config directory. On Windows the mode bits are not enforced; the file is protected by the ACL of your %AppData%\ytrack folder, which by default only your account can read.

ytrack auth status        # hosts, accounts, masked tokens; exit 4 if not logged in
ytrack auth switch --host tools.acme.com/youtrack
ytrack auth token         # print the token (only on request)
ytrack auth logout

Issues

ytrack issue list -q 'project: APP for: me #Unresolved'      # native query syntax
ytrack issue list --project APP --assignee me --state Open --sort 'updated desc'
ytrack issue list --project APP --all                         # resolved too
ytrack issue list -q '#Unresolved' --json idReadable,summary,state,url
ytrack issue view APP-123 --comments
ytrack issue view https://acme.youtrack.cloud/issue/APP-123 --web
ytrack issue comment APP-123 --body 'Reproduced on 2026.2'
git log -1 --format=%B | ytrack issue comment APP-123 --body-file -

Without --query or --state, issue list shows only unresolved issues (it adds #Unresolved); --all includes resolved ones. --json with no fields lists the available ones. Only the attributes needed for the table or the requested fields are fetched. In issue list, -q is --query; use --jq for jq. --limit defaults to 30; --limit 0 lists all. The editor for issue comment --editor is $YTRACK_EDITOR, $GIT_EDITOR, $VISUAL or $EDITOR.

Commands
ytrack issue create --project APP --summary 'Login fails on Safari'
ytrack issue edit APP-123 --summary 'Login fails on Safari 18' --field 'Priority=Critical'
ytrack issue command APP-123 'State In Progress for me'
ytrack issue command APP-123 APP-124 APP-130 'Assignee me' --dry-run   # preview only
ytrack issue command APP-123 APP-124 'tag regression' --json issues,commands

issue command takes YouTrack's own command language. The last argument is the command and every argument before it is an issue; all of them change in one request. --dry-run asks YouTrack how it parses the command and changes nothing (exit 1 when a part is not understood); --comment adds a comment with the change and --silent skips notifications. --json reports issue, url, issues (every issue with its URL), command, dryRun and commands (the parsed parts).

Time tracking

ytrack work-item list APP-123 --author me --since 2026-10-01
ytrack work-item add APP-123 --duration 1h30m --text 'Code review'
ytrack work-item add APP-123 --duration 1.5h --date 2026-10-06 --type Development
ytrack work-item add TEAM-1 --duration 30m --meeting        # text "Meetings"
ytrack work-item edit APP-123 115-3 --duration 2h
ytrack work-item delete APP-123 115-3 --yes

--duration takes 1h30m, 1h 30m, 90m, 1.5h, 2 hours 15 minutes or a bare number of minutes. Days and weeks are refused (their length depends on the instance's work schedule). --date auto (the default) is today in your work timezone: timezone: Europe/Madrid in config.yml when set, otherwise the system timezone (TZ). YouTrack stores the day only, at midnight UTC. --type takes a work item type name from the project's time tracking settings; an unknown name lists the valid ones. delete asks first in a terminal and needs --yes otherwise.

Raw API

ytrack api /users/me --fields login,fullName
ytrack api /issues -X GET -f query='project: APP #Unresolved' --fields idReadable,summary --paginate
ytrack api /issues --fields idReadable --jq '.[].idReadable'
ytrack api /issues -F 'project[id]=0-0' -f summary='New issue'
ytrack api /commands --input command.json

/issues and /api/issues are the same path. -f, -F and --input make the request a POST unless you pass -X GET, and a POST to /issues creates an issue, so reads with parameters need -X GET. --paginate (GET only) pages with $skip/$top and prints one JSON array. The token is sent only to the configured service URL: redirects to other hosts and from https to http are refused. Plain-http hosts other than localhost trigger a warning. See ytrack api --help.

Scripting

  • Data goes to stdout; errors and prompts to stderr. On a terminal, help and output are colored: issue IDs, commands and flags in an accent color, summaries and headings bold, states and priorities by meaning (resolved green, open or in progress yellow, critical red), errors red with the command to run in bold. Color is off when the stream is not a terminal, under NO_COLOR, TERM=dumb, --json or the --no-color flag; no prompts when output is not a terminal.
  • --json <fields> (where offered), --jq and --template follow gh.
  • Exit codes: 0 success, 1 failure (including usage errors), 2 cancelled, 4 authentication required.
  • Environment: YTRACK_HOST, YTRACK_TOKEN (runtime override, never saved), YTRACK_DEBUG=1 (request log with credentials redacted, same as --debug), YTRACK_CONFIG_DIR, YTRACK_BROWSER, YTRACK_EDITOR, YTRACK_NO_UPDATE_NOTIFIER=1 (no new-release notice).
  • Host precedence: --host, YTRACK_HOST, the default host. Token precedence: YTRACK_TOKEN, then the stored token. YTRACK_TOKEN goes to a host named by --host or YTRACK_HOST without a warning (the CI setup), and to a host taken from a pasted issue URL only when that host is logged in.

Configuration lives in ~/.config/ytrack/ ($XDG_CONFIG_HOME/ytrack, %AppData%\ytrack on Windows): config.yml (browser, timezone, check_update) and hosts.yml, which never holds tokens. The daily update check keeps its state in ~/.local/state/ytrack/state.yml ($XDG_STATE_HOME/ytrack, %LOCALAPPDATA%\ytrack on Windows).

Shell completion: install.sh installs it for zsh, bash or fish (from $SHELL) and prints how to enable it; install.ps1 prints the PowerShell profile line. Otherwise run ytrack completion bash|zsh|fish|powershell. Completion suggests commands, flags, --json fields, issue IDs (with their summaries) and --project names. See docs/install.md.

Agent skill

No coding agent was trained on ytrack, so agents guess gh habits (--hostname instead of --host, --title instead of --summary) or scrape the YouTrack web page. The ytrack agent skill teaches them the real commands: hosts and auth, issue queries, create, edit and comment, YouTrack commands (--dry-run first, locale-proof field names), work items, --json/--jq, ytrack api as the escape hatch, and what to tell you on exit code 4. It never has an agent handle your token.

With skills.sh, for the agents it supports:

npx skills add BrainerVirus/youtrack-cli

Or from the binary, which installs the skill matching its own version (metadata.version in SKILL.md); rerun it after ytrack upgrade:

ytrack skill install --dir ~/.claude/skills          # Claude Code
ytrack skill install --dir ~/.codex/skills           # Codex
ytrack skill install --dir ~/.cursor/skills          # Cursor
ytrack skill install --dir ~/.config/opencode/skills # OpenCode
ytrack skill install --dir ~/.pi/agent/skills        # Pi
ytrack skill install --dir ~/.agents/skills          # agents that read ~/.agents/skills
ytrack skill install --dir .claude/skills --json     # one project; prints {"path", "version"}
ytrack skill print                                   # SKILL.md on stdout

ytrack skill install writes <dir>/ytrack/SKILL.md and references/, replacing an earlier ytrack skill there by renaming the new copy into place; it refuses a ytrack directory that holds anything else and leaves it untouched. Both commands work offline and logged out.

Workit installs and updates the skill for the agents it sets up, so with Workit you need neither command.

A test checks every ytrack command and flag the skill names against the command tree, so the skill cannot drift from the binary.

Development

make build test lint
make snapshot              # local release dry run into dist/ (needs goreleaser v2)
make it YTRACK_IT_PROJECT=<short>   # opt-in suite against your own YouTrack instance

make it runs the real-instance suite with the session from ytrack auth login against a personal scratch project: it creates issues prefixed ytrack-it, works on them and deletes them, and refuses hosts other than *.youtrack.cloud unless you allow one. See docs/integration-tests.md before running it.

Releases: from an up-to-date main, run make release VERSION=v0.1.0. It runs the tests, tags main and pushes the tag; the Release workflow then builds the archives with goreleaser, signs the checksums file with cosign keyless (the workflow's GitHub OIDC identity), publishes the GitHub release with a changelog grouped from the conventional commit titles, and updates the Homebrew cask when the HOMEBREW_TAP_GITHUB_TOKEN secret is set (the upload is skipped without it).

To rerun a release, dispatch the workflow from the tag itself, never from a branch: gh workflow run release.yml --ref v0.1.0 -f tag=v0.1.0. The signature's identity is the ref the run was dispatched from, and ytrack upgrade and the install scripts accept only refs/tags/vX.Y.Z[-pre]; the workflow refuses a dispatch whose ref is not the tag it releases.

The REST surface ytrack relies on is listed by hand in api/contract/youtrack-contract.json, derived from JetBrains' public YouTrack REST API docs. Tests check every request against it, and a weekly workflow checks it against the live API description.

See AGENTS.md for layout and conventions.

License

MIT. Parts are adapted from GitHub CLI (MIT); see NOTICE.

Directories

Path Synopsis
cmd
ytrack command
Command ytrack is an unofficial command-line interface for JetBrains YouTrack.
Command ytrack is an unofficial command-line interface for JetBrains YouTrack.
internal
auth
Package auth stores and resolves YouTrack tokens.
Package auth stores and resolves YouTrack tokens.
browser
Package browser opens URLs in the user's web browser.
Package browser opens URLs in the user's web browser.
build
Package build exposes version information injected at link time.
Package build exposes version information injected at link time.
clierr
Package clierr defines the error kinds commands return and the stable exit codes they map to.
Package clierr defines the error kinds commands return and the stable exit codes they map to.
cmdtest
Package cmdtest runs ytrack commands in-process against fake IO, a temp config dir, go-keyring's mock and a fake YouTrack server.
Package cmdtest runs ytrack commands in-process against fake IO, a temp config dir, go-keyring's mock and a fake YouTrack server.
config
Package config reads and writes ytrack's configuration directory:
Package config reads and writes ytrack's configuration directory:
editor
Package editor opens text in the user's editor, as git and gh do.
Package editor opens text in the user's editor, as git and gh do.
hosts
Package hosts normalizes YouTrack service URLs.
Package hosts normalizes YouTrack service URLs.
iostreams
Package iostreams bundles stdin/stdout/stderr with the terminal facts commands need: whether each stream is a TTY, whether color is on, and the terminal width.
Package iostreams bundles stdin/stdout/stderr with the terminal facts commands need: whether each stream is a TTY, whether color is on, and the terminal width.
output
Package output renders command results: JSON (optionally filtered by jq or a Go template), and tables.
Package output renders command results: JSON (optionally filtered by jq or a Go template), and tables.
prompter
Package prompter asks the user for input on the terminal.
Package prompter asks the user for input on the terminal.
skill
Package skill renders and installs the agent skill embedded in the binary (skills/ytrack), stamped with the binary's version so an installed skill always describes the ytrack that installed it.
Package skill renders and installs the agent skill embedded in the binary (skills/ytrack), stamped with the binary's version so an installed skill always describes the ytrack that installed it.
update
Package update finds ytrack releases on GitHub, compares versions, keeps the once-a-day update check state, and tells which package manager owns an installed binary.
Package update finds ytrack releases on GitHub, compares versions, keeps the once-a-day update check state, and tells which package manager owns an installed binary.
upgrade
Package upgrade downloads a ytrack release, verifies it and replaces the running binary with it.
Package upgrade downloads a ytrack release, verifies it and replaces the running binary with it.
upgrade/upgradetest
Package upgradetest provides Sigstore bundles signed by sigstore-go's virtual Sigstore and a fake GitHub release server for tests.
Package upgradetest provides Sigstore bundles signed by sigstore-go's virtual Sigstore and a fake GitHub release server for tests.
worktime
Package worktime parses the durations and dates of YouTrack work items.
Package worktime parses the durations and dates of YouTrack work items.
youtrack/adapter
Package adapter is the typed YouTrack API surface commands use.
Package adapter is the typed YouTrack API surface commands use.
youtrack/adapter/customfields
Package customfields decodes YouTrack's polymorphic issue custom fields into ytrack's own values.
Package customfields decodes YouTrack's polymorphic issue custom fields into ytrack's own values.
youtrack/transport
Package transport is ytrack's HTTP layer for the YouTrack REST API: it authenticates requests, identifies the client, logs redacted debug traces and turns error responses into *APIError.
Package transport is ytrack's HTTP layer for the YouTrack REST API: it authenticates requests, identifies the client, logs redacted debug traces and turns error responses into *APIError.
pkg
cmd/api
Package api implements `ytrack api`, the raw REST escape hatch, modelled on `gh api` from github.com/cli/cli (MIT).
Package api implements `ytrack api`, the raw REST escape hatch, modelled on `gh api` from github.com/cli/cli (MIT).
cmd/auth
Package auth implements `ytrack auth`.
Package auth implements `ytrack auth`.
cmd/auth/login
Package login implements `ytrack auth login`.
Package login implements `ytrack auth login`.
cmd/auth/logout
Package logout implements `ytrack auth logout`.
Package logout implements `ytrack auth logout`.
cmd/auth/status
Package status implements `ytrack auth status`.
Package status implements `ytrack auth status`.
cmd/auth/switch
Package authswitch implements `ytrack auth switch`.
Package authswitch implements `ytrack auth switch`.
cmd/auth/token
Package token implements `ytrack auth token`.
Package token implements `ytrack auth token`.
cmd/factory
Package factory builds the production cmdutil.Factory.
Package factory builds the production cmdutil.Factory.
cmd/issue
Package issue implements `ytrack issue`.
Package issue implements `ytrack issue`.
cmd/issue/command
Package command implements `ytrack issue command`.
Package command implements `ytrack issue command`.
cmd/issue/comment
Package comment implements `ytrack issue comment`.
Package comment implements `ytrack issue comment`.
cmd/issue/create
Package create implements `ytrack issue create`.
Package create implements `ytrack issue create`.
cmd/issue/edit
Package edit implements `ytrack issue edit`.
Package edit implements `ytrack issue edit`.
cmd/issue/list
Package list implements `ytrack issue list`.
Package list implements `ytrack issue list`.
cmd/issue/shared
Package shared holds what the issue commands have in common: issue arguments, the --json field contract and issue URLs.
Package shared holds what the issue commands have in common: issue arguments, the --json field contract and issue URLs.
cmd/issue/view
Package view implements `ytrack issue view`.
Package view implements `ytrack issue view`.
cmd/root
Package root assembles the ytrack command tree and runs it.
Package root assembles the ytrack command tree and runs it.
cmd/skill
Package skill implements `ytrack skill`: the agent skill embedded in the binary, printed or installed for a coding agent.
Package skill implements `ytrack skill`: the agent skill embedded in the binary, printed or installed for a coding agent.
cmd/upgrade
Package upgrade implements `ytrack upgrade`.
Package upgrade implements `ytrack upgrade`.
cmd/version
Package version implements `ytrack version`.
Package version implements `ytrack version`.
cmd/workitem
Package workitem implements `ytrack work-item`.
Package workitem implements `ytrack work-item`.
cmd/workitem/add
Package add implements `ytrack work-item add`.
Package add implements `ytrack work-item add`.
cmd/workitem/delete
Package delete implements `ytrack work-item delete`.
Package delete implements `ytrack work-item delete`.
cmd/workitem/edit
Package edit implements `ytrack work-item edit`.
Package edit implements `ytrack work-item edit`.
cmd/workitem/list
Package list implements `ytrack work-item list`.
Package list implements `ytrack work-item list`.
cmd/workitem/shared
Package shared holds what the work-item commands have in common: the --json field contract, work item type resolution and work dates.
Package shared holds what the work-item commands have in common: the --json field contract, work item type resolution and work dates.
cmdutil
Package cmdutil holds what commands share: the dependency Factory, argument validators and the --json/--jq/--template flags.
Package cmdutil holds what commands share: the dependency Factory, argument validators and the --json/--jq/--template flags.
Package scripts holds the tests of the repository's install scripts, install.sh (Linux, macOS) and install.ps1 (Windows), which run them against a fake release mirror.
Package scripts holds the tests of the repository's install scripts, install.sh (Linux, macOS) and install.ps1 (Windows), which run them against a fake release mirror.
Package skills embeds the agent skills shipped in this directory, in the skills.sh layout (skills/<name>/SKILL.md), so the binary installs the skill that matches its own version.
Package skills embeds the agent skills shipped in this directory, in the skills.sh layout (skills/<name>/SKILL.md), so the binary installs the skill that matches its own version.
test
integration
Package integration holds ytrack's opt-in real-instance suite: it drives the built ytrack binary against a personal YouTrack instance when YTRACK_IT=1 is set, and is skipped otherwise.
Package integration holds ytrack's opt-in real-instance suite: it drives the built ytrack binary against a personal YouTrack instance when YTRACK_IT=1 is set, and is skipped otherwise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL