youtrack-cli

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 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 and commenting on issues, and time tracking (work items).

Install

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. Check a download before unpacking it:

sha256sum --check --ignore-missing ytrack_0.1.0_checksums.txt     # Linux
shasum -a 256 --check --ignore-missing ytrack_0.1.0_checksums.txt # macOS

On Windows, compare Get-FileHash ytrack_0.1.0_windows_amd64.zip with the line in the checksums file.

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

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.

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 -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. --paginate 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. No color or prompts when output is not a terminal (NO_COLOR also disables color).
  • --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.
  • 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) and hosts.yml, which never holds tokens.

Shell completion: ytrack completion bash|zsh|fish|powershell.

Development

make build test lint
make snapshot              # local release dry run into dist/ (needs goreleaser v2)

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, publishes the GitHub release with a changelog grouped from the conventional commit titles, and updates the Homebrew cask.

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.
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/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.

Jump to

Keyboard shortcuts

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