youtrack-issue
v0.3.4
Published
Standalone CLI for reading YouTrack issues, queries, projects, and local profile config
Readme
youtrack-issue
Standalone CLI for reading YouTrack issues, queries, projects, and local profile config.
Contributing notes: see CONTRIBUTING.md.
Install
Global install from npm:
npm install -g youtrack-issueThe package exposes both:
youtrack-issue --help
ytissue --helpFor local development from this repo:
npm linkQuick Start
With environment variables:
export YTISSUE_TOKEN="perm-..."
export YTISSUE_BASE_URL="https://youtrack.example.com"
ytissue AB-1234With a global profile config in ~/.config/youtrack-issue/config.json:
{
"defaultProfile": "work",
"profiles": {
"work": {
"baseUrl": "https://youtrack.example.com",
"token": "paste-your-token-here"
}
}
}Then:
ytissue AB-1234
ytissue work AB-1234
ytissue --profile work AB-1234profile is the preferred term going forward. For backward compatibility, the CLI still accepts the older --alias flag and the legacy aliases / defaultAlias config shape.
Configuration
Supported environment variables:
YTISSUE_TOKENYTISSUE_BASE_URLYTISSUE_CONFIGYTISSUE_TIMEOUT_MS
Config path precedence:
--configYTISSUE_CONFIGYTISSUE_CONFIGfrom~/.config/youtrack-issue/config.env~/.config/youtrack-issue/config.json
Additional config sources:
~/.config/youtrack-issue/config.envconfig.example.jsonin this repo as a safe example
Any string value in the JSON config may reference environment variables:
{
"defaultProfile": "${YTISSUE_DEFAULT_PROFILE}",
"profiles": {
"work": {
"baseUrl": "${YTISSUE_WORK_BASE_URL}",
"token": "${YTISSUE_WORK_TOKEN}"
}
}
}When invoked as a global command, the CLI does not read the current directory .env files. Current-directory .env / .env.local loading only applies to direct script execution such as node ./bin/ytissue.mjs ....
Compatibility note:
--aliasis still accepted as a legacy synonym for--profile- the short
-aflag is no longer supported -awas intentionally retired so the short-option space remains available for future CLI growth
Common Commands
Single issue:
ytissue AB-1234
ytissue AB-1234 --json
ytissue AB-1234 --comments
ytissue AB-1234 --comments-only
ytissue AB-1234 --linked-issues
ytissue AB-1234 --spent-time
ytissue AB-1234 --work-items
ytissue AB-1234 --attachments
ytissue AB-1234 --attachment-info invoice.pdf
ytissue AB-1234 --attachment-info invoice.pdf --json
ytissue AB-1234 --download-attachment invoice.pdf --output ./invoice.pdf
ytissue AB-1234 --download-attachment invoice.pdf --stdout > invoice.pdf
ytissue AB-1234 --fields
ytissue AB-1234 --field summary --field "Spent time"File output rule:
- file-writing actions require an explicit output target
- use exactly one of
--output <path>or--stdout --download-attachmentwithout one of those flags fails with an error--download-attachmentalways means attachment content;--jsonis ignored in that mode
Compatibility note:
- previous versions saved
--download-attachmentoutput automatically into the current working directory - that implicit default save behavior has been removed
- downloads now require an explicit
--output <path>or--stdout - if you previously used
--download-attachment ... --jsonfor metadata, use--attachment-info <id-or-name> --jsoninstead
Queries and projects:
ytissue --list
ytissue --list --limit 20
ytissue --search "project: AB"
ytissue --search "project: AB" --brief
ytissue --projects
ytissue --projects --brief
ytissue -lbn 20
ytissue -bs "project: AB" -n 20Config management:
ytissue config list-profiles
ytissue config add-profile work --base-url https://youtrack.example.com --token '${YTISSUE_WORK_TOKEN}' --set-default
ytissue config set-default work
ytissue config remove-profile workLegacy compatibility is still supported:
ytissue --alias work AB-1234
ytissue config list-aliases
ytissue config add-alias work --base-url https://youtrack.example.com --token '${YTISSUE_WORK_TOKEN}' --set-default
ytissue config remove-alias workCustom config path:
ytissue -c ./config.example.json config list-profiles
ytissue -c ./config.example.json --profile work AB-1234Help
ytissue --helpTesting
The committed test suite is fully offline:
npm testLocal smoke checks against a real YouTrack server are optional:
- copy
config.smoke.example.jsontoconfig.smoke.json - optionally copy
test/local.smoke.example.mjsto a localtest/*.smoke.test.mjsfile - or create your own
test/*.smoke.test.mjsfile directly - adjust the config and test data for your own YouTrack instance
- run
npm run test:smoke
Both config.smoke.json and test/*.smoke.test.mjs are gitignored by design.
