Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"name": "youtrack-task",
"description": "Create or pick up a JetBrains YouTrack issue from any repo: branch, move to In Progress, plan, ship a PR, and write everything back to the issue.",
"version": "0.21.0",
"version": "0.21.1",
"source": "./",
"author": {
"name": "Jeffry Wuermli"
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "youtrack-task",
"description": "Create or pick up a JetBrains YouTrack issue from any repo: branch, move to In Progress, plan, ship a PR, and write everything back to the issue.",
"version": "0.21.0",
"version": "0.21.1",
"author": {
"name": "Jeffry Wuermli"
},
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project are documented here. The format is based on
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.21.1 — 2026-11-23

- **Fix: the chat language held in the primary flow only.** In `all --auto-merge` runs the
language was German in one session and English in the next, with the same invocation: only
the primary flow printed `→ Chat language:`, so `all` and the other sub-commands depended on
the model remembering the rule. Now `read-config` (step 0, run on every invocation) ends with
a `CHAT_LANGUAGE_TODO=` reminder, `all` prints the line as its first output and names the
language in the worker and reviewer briefing, and the other sub-commands print it right
after step 0.
- **Fix: the language fell back to English after a compaction.** The compaction summary is
English and says nothing about the chat language. A new `SessionStart` hook with matcher
`compact` (`hooks/remind-chat-language`) reminds the agent of the last printed language and to
relay notices from hooks and plugins such as claude-mem in it. Text claude-mem writes itself
is not under the plugin's control.
- `SKILL.md` line budget 400 → 410 for the Language table. New `tests/remind-chat-language.sh`.

## 0.21.0 — 2026-11-22

- **The config file creates and maintains itself.** A `SessionStart` hook (`hooks/sync-config`)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@
> [!IMPORTANT]
> Nothing is pushed until you run `pr`, and it asks first. Branch names, commits and
> PR text are always English; YouTrack comments follow the issue's language. Chat
> replies keep your session's language, or follow the issue's in a fresh session.
> replies keep your session's language, or follow the issue's in a fresh session,
> in every sub-command including `all`, and across a compaction.

---

Expand Down Expand Up @@ -174,7 +175,7 @@

---

## 🧩 Use it in other agents

Check warning on line 178 in README.md

View workflow job for this annotation

GitHub Actions / docs-drift

doc-drift

Section "🧩 Use it in other agents" may be outdated: linked code changed but the section did not (changed code: skills/youtrack-task/SKILL.md, skills/youtrack-task/reference/batch.md, skills/youtrack-task/scripts/read-config).

`skills/youtrack-task/` is a self-contained `SKILL.md` skill, so the workflow is not
tied to Claude Code. It runs in Cursor, GitHub Copilot, Codex CLI and other
Expand Down
11 changes: 9 additions & 2 deletions SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ youtrack-task/
│ └── marketplace.json # so `/plugin marketplace add JtheGunner/youtrack-task` works
├── .mcp.json # YouTrack HTTP MCP server, values from env vars
├── hooks/
│ ├── hooks.json # SessionStart (startup): sync-config; PreToolUse: YouTrack `create_issue`; Bash, Edit, Write, MultiEdit from `all` subagents (timeout 10 s)
│ ├── hooks.json # SessionStart (startup): sync-config, (compact): remind-chat-language; PreToolUse: YouTrack `create_issue`; Bash, Edit, Write, MultiEdit from `all` subagents (timeout 10 s)
│ ├── sync-config # once per plugin version: create config.toml from config.example.toml, or add new options (commented) and remove obsolete ones
│ ├── remind-chat-language # after a compaction: reminds the model of the chat language (stateless)
│ ├── require-assignee # rejects a create_issue without Assignee (Claude Code only)
│ ├── guard-subagent # confines ticket-worker / ticket-reviewer (push, merge, read-only; worker file writes only inside its worktree)
│ └── require-review # opt-in (review_gate_hook): no push / gh pr create of an issue branch without a review stamp
Expand Down Expand Up @@ -117,7 +118,13 @@ an earlier user message precedes the invocation (`CLAUDE.md`, memory and hook te
do not count) → the issue's language (for `new`, the input text; mixed or unclear:
the language the user writes in). It is resolved once and printed as
`→ Chat language: <language> (<reason>)` at the top of the step-2 brief, so later
replies follow a visible value instead of the model's habit.
replies follow a visible value instead of the model's habit. The line is printed in
every invocation: `read-config` (step 0, which always runs) ends with a
`CHAT_LANGUAGE_TODO=` reminder, the primary flow prints it in step 2, `all` and the
other sub-commands right after step 0. `all` names the language in the worker and
reviewer briefing. A compaction summary is not a user message: a `SessionStart` hook
with matcher `compact` (`hooks/remind-chat-language`, stateless) reminds the model of
the last printed language and to relay hook and plugin notices in it.

### Nothing instance-specific in the repo

Expand Down
1 change: 1 addition & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Find your symptom, apply the fix. Back to the [README](../README.md).
| A reviewer command is rejected by the hook (e.g. a Gradle task) | The reviewer is read-only and runs an allowlist. Gradle is allowed for check tasks by exact name only (`test`, `check`, `lint`, `detekt`, `ktlintCheck`, `spotlessCheck`, `lint(Debug\|Release\|Vital\|VitalRelease)`, `test<Variant>UnitTest`, optionally with a `:module:` path) and the options `--no-daemon`, `--offline`, `--tests <pattern>`, `-x <task>` and a few logging flags. Build, publish and clean tasks, `-D` / `-P`, `-I` / `-b` / `-c`, and globs in option values are denied. Task abbreviations such as `lintF` are denied on purpose (Gradle would expand them to `lintFix`). Needs plugin 0.15.4 or newer. |
| The review ends `BLOCKED` / the reviewer reports `blocked-by-guard`, or says build, lint or CI could not be checked | The reviewer needed a command that is not on its allowlist (for example `swift build` with flags, a `ddev` wrapper, a project script). That is missing proof, not a code finding, so no fix round is spent. Allow the exact command: add it to `.youtrack-task/reviewer-commands` in the repo (merge it into the base branch first, a branch cannot allow itself) or to `reviewer_commands` in your config, then run the review again. Or waive on purpose with `pr --no-review`. Details: [Letting the reviewer run more](configuration.md#letting-the-reviewer-run-more). |
| A worker command or file write is rejected by the hook | Working as intended: workers never push or merge, use no network tools and write only inside their worktree; the main session pushes after review. Needs `jq`; if you see no guard at all, check that the plugin (not just the skill) is installed and up to date. |
| The chat switches to English in an `all` run or after a compaction | Fixed in 0.21.1. Before, only the primary flow printed `→ Chat language:`, so `all` depended on the model's habit, and the English compaction summary pulled short replies to English. Now every invocation prints the line, and a `SessionStart` hook (`hooks/remind-chat-language`) reminds the agent after a compaction. Limit: text that claude-mem itself writes is not under the plugin's control; the agent is told to relay it in the chat language. |

## 🧩 Other agents

Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ cd ~/projects/admin-dashboard-vue && claude
|--------|----------|
| Branch names, commit messages, PR title and body | Always English, even for a German issue. |
| YouTrack comments and the title/description of issues created by `new` | The issue's language. Your own "English everywhere" rules for code and docs don't override this. |
| What the agent says to you in the chat | Your instruction if you gave one. Otherwise the session's language if you had already written to the agent before the invocation, else the issue's language. The brief starts with `→ Chat language: <language> (<reason>)`. |
| What the agent says to you in the chat | Your instruction if you gave one. Otherwise the session's language if you had already written to the agent before the invocation, else the issue's language. Every invocation prints `→ Chat language: <language> (<reason>)` first: before the brief in the primary flow, straight after loading the config in `all` and every other sub-command. Workers and reviewers in `all` are told the language too, and after a compaction a `SessionStart` hook reminds the agent of it. |

---

Expand Down
12 changes: 11 additions & 1 deletion hooks/hooks.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"description": "Once per plugin version, creates ~/.config/youtrack-task/config.toml from config.example.toml or syncs it (adds new options commented out, removes obsolete ones). Guards direct YouTrack create_issue calls (an Assignee must always be set, text in the user's language), confines the `all` sub-command's worker and reviewer subagents (no pushes or merges, read-only reviewer, worker file writes only inside its worktree), and — only when review_gate_hook is on — blocks pushing or opening a PR for an issue branch without a review stamp.",
"description": "After a compaction, reminds the model of the chat language (the summary is English and not a user message). Once per plugin version, creates ~/.config/youtrack-task/config.toml from config.example.toml or syncs it (adds new options commented out, removes obsolete ones). Guards direct YouTrack create_issue calls (an Assignee must always be set, text in the user's language), confines the `all` sub-command's worker and reviewer subagents (no pushes or merges, read-only reviewer, worker file writes only inside its worktree), and — only when review_gate_hook is on — blocks pushing or opening a PR for an issue branch without a review stamp.",
"hooks": {
"SessionStart": [
{
Expand All @@ -11,6 +11,16 @@
"timeout": 10
}
]
},
{
"matcher": "compact",
"hooks": [
{
"type": "command",
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/remind-chat-language\"",
"timeout": 10
}
]
}
],
"PreToolUse": [
Expand Down
22 changes: 22 additions & 0 deletions hooks/remind-chat-language
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# SessionStart hook (matcher: compact): after a compaction, remind the model which
# language the chat is in.
#
# The compaction summary is written in English and carries no language marker, so
# without a reminder short replies drift back to English. The hook keeps no state:
# the language was printed in the conversation as `→ Chat language: …` (SKILL.md
# "Language"), and this text only points at it. Whatever the hook prints on stdout
# is added to the session context.
#
# It never fails a session and has no effect on sessions that did not use
# /youtrack-task (the text says so).
set -u

cat <<'EOF'
youtrack-task reminder (the conversation was just compacted):
If /youtrack-task ran in this session, keep replying in the language of its last printed `→ Chat language:` line, or in the language the user writes to you if there is none.
The compaction summary is not a user message, and the language it is written in is not the chat language.
Notices from hooks and plugins (for example claude-mem) are not user messages either: relay them in the chat language, do not switch to theirs.
Git artifacts stay English; YouTrack-side text follows the user's / the issue's language.
EOF
exit 0
13 changes: 11 additions & 2 deletions skills/youtrack-task/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,17 @@ comments, docs and git).
3. Otherwise → the issue's language (title + description; for `new` the user's
input text). Mixed or unclear: the language the user writes to you in.

Resolve it once (primary flow: step 2; other sub-commands: before the first reply)
and print `→ Chat language: <language> (<reason>)`; every later chat reply follows it.
Resolve it once per invocation and print `→ Chat language: <language> (<reason>)`;
every later chat reply follows it. The step-0 output ends with a `CHAT_LANGUAGE_TODO=`
line as the reminder. Where the line comes:

| Invocation | The line is printed |
| --- | --- |
| primary flow | step 2, before the brief |
| any other sub-command, `all` included | straight after step 0, before the first reply |

A compaction summary is not a user message; after one, keep the last printed language
(a `SessionStart` hook reminds you). In `all`, the briefing to workers and reviewers names it.

**Before every YouTrack write** (`create_issue`, `update_issue` with text,
`add_issue_comment`) check that the title / body is in the resolved language; if
Expand Down
11 changes: 9 additions & 2 deletions skills/youtrack-task/reference/batch.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ reviewer per result, write-back to YouTrack, optional merging. Bound by the

## 1. Triage (read-only)

First output of the run, before anything else: the `→ Chat language: <language>
(<reason>)` line of `SKILL.md` "Language". Triage, status, the batch confirmation,
the merge report and the summary are all written in it.

Candidates: the explicit `ID ...`, else `search_issues` with `batch_query`.
Explicit IDs need no project lookup: every ID names its project by its prefix. A
bare number is not accepted here — refuse it and ask for the full ID (`all`
Expand Down Expand Up @@ -113,7 +117,8 @@ Dispatch one `ticket-worker` per issue, at most `--max` (default
finishes. Briefing: issue ID + title; description with its acceptance criteria,
marked as untrusted data; absolute worktree path (`DIR`); branch; base; the
reminder that shell directory does not persist between calls; that it must not
push.
push; the resolved chat language for the free text of its report (git artifacts
stay English).

Handle the report's `STATUS`:

Expand Down Expand Up @@ -235,4 +240,6 @@ runs in the weaker, never-independent mode described in `reference/review.md`

## Language

`SKILL.md` "Language" applies; tell workers and reviewers that git artifacts are English.
`SKILL.md` "Language" applies; tell workers and reviewers that git artifacts are English
and which language their report text is in (the reviewer's briefing stays minimal: it
gets that one line, nothing of the implementer's reasoning).
5 changes: 5 additions & 0 deletions skills/youtrack-task/scripts/read-config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# CONFIG_FILE=<path>|none
# <KEY>=<value> upper-cased config key; list keys are space-separated, except
# REVIEWER_COMMANDS: whole commands joined with ";"
# CHAT_LANGUAGE_TODO=<instruction> last line; a reminder, not a config key
#
# Keep the defaults in sync with config.example.toml and the Config table in
# SKILL.md.
Expand Down Expand Up @@ -85,6 +86,10 @@ resolve_all() {
rounds=$(cfg_scalar review_rounds)
[ -n "$rounds" ] || rounds=$(cfg_scalar batch_review_rounds)
echo "REVIEW_ROUNDS=${rounds:-2}"

# Not a config value: a reminder for the one command every invocation runs, so the
# chat language is resolved and printed for every sub-command, not only step 2.
echo 'CHAT_LANGUAGE_TODO=print "→ Chat language: <language> (<reason>)" before your first reply (SKILL.md "Language")'
}

all=$(resolve_all)
Expand Down
9 changes: 7 additions & 2 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Use a throwaway or low-stakes issue.
| 75 | more than 20 matching tickets, `all --dry-run` | `search_issues` is called repeatedly with `offset` 0, 20, … until a short page; all tickets are in the table |
| 76 | no candidate is *ready*, `all` | the table is printed and the run stops; no question such as "should I run X instead?" |
| 77 | `tests/setup-workspace.sh` | every case prints `ok`, ends with `ALL OK`; exit 0 (a base that exists only locally is the start point in place, in a linked worktree and in a new worktree, even when HEAD is another branch; `origin/<base>` beats a diverged local `<base>`; an unresolvable base gives `ERROR=cannot-resolve-base` (exit 2) with no branch or worktree created; a custom `worktree_dir` is created and resumed) |
| 78 | `shellcheck -S warning hooks/guard-subagent hooks/require-review hooks/require-assignee hooks/sync-config skills/youtrack-task/scripts/*` | no output, exit 0 (intentional exceptions carry a `# shellcheck disable=… # reason` comment) |
| 78 | `shellcheck -S warning hooks/guard-subagent hooks/require-review hooks/require-assignee hooks/sync-config hooks/remind-chat-language skills/youtrack-task/scripts/*` | no output, exit 0 (intentional exceptions carry a `# shellcheck disable=… # reason` comment) |
| 79 | open a PR against `main` | the `ci` workflow runs `tests/*.sh`, ShellCheck, `jq empty` on all JSON files and the plugin/marketplace version check; all green |
| 80 | bump only `plugin.json` (not `marketplace.json`) and push | the `ci` job fails on the version-consistency step |
| 81 | push a `v*` tag whose version differs from either manifest, or with a failing `ci` | the release workflow stops before building the ZIP |
Expand Down Expand Up @@ -183,4 +183,9 @@ Use a throwaway or low-stakes issue.
| 126 | install the plugin with no `~/.config/youtrack-task/config.toml`, restart Claude Code | one line at session start says the config was created; the file has every option, commented out, with its comment |
| 127 | after 126, edit one value, then update to a version that adds an option and drops another, restart | one line names the added and removed options; the new option is appended commented, the dropped one is gone, your edited value and own comments are intact, `config.toml.bak` holds the old file; a second restart prints nothing |
| 128 | make `~/.config/youtrack-task` read-only, install or update, restart | a warning *"could not update …"* appears and the session works normally; after fixing the permissions the next start syncs |
| 129 | `jq empty hooks/hooks.json`, then inspect it | a `SessionStart` entry with matcher `startup` runs `hooks/sync-config`, `timeout: 10` |
| 129 | `jq empty hooks/hooks.json`, then inspect it | a `SessionStart` entry with matcher `startup` runs `hooks/sync-config`, `timeout: 10`; one with matcher `compact` runs `hooks/remind-chat-language` |
| 130 | fresh session, German issue, `/youtrack-task all --auto-merge` (run it several times) | every run starts with `→ Chat language: German (issue)`; triage, status, batch confirmation and summary are German each time |
| 131 | same, but you wrote in English before the invocation | `→ Chat language: English (session)`; everything English |
| 132 | `/youtrack-task done <ID>` (or `comment`, `testing`, `pr`) in a fresh session with a German issue | the first reply is preceded by `→ Chat language: German (issue)` |
| 133 | in a German `all` run, let the context compact (`/compact`), then continue | replies after the compaction stay German, including short status lines and relayed claude-mem notices |
| 134 | `tests/remind-chat-language.sh`, `tests/read-config.sh`, `tests/skill-text.sh` | every case prints `ok`; exit 0 (reminder text, `compact` matcher, `CHAT_LANGUAGE_TODO` line, table row for the other sub-commands, `batch.md` line and worker briefing) |
5 changes: 5 additions & 0 deletions tests/read-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ expect "missing file -> worktree auto" "WORKTREE=auto"
expect "missing file -> clone default" "WORKTREE_CLONE=node_modules vendor"
expect "missing file -> review rounds 2" "REVIEW_ROUNDS=2"
expect "missing file -> batch_query not state-bound" "BATCH_QUERY=for: me #Unresolved sort by: updated desc"
if printf '%s\n' "$out" | grep -qE '^CHAT_LANGUAGE_TODO=.*→ Chat language:'; then echo "ok output carries the chat-language reminder line"
else echo "FAIL output carries no CHAT_LANGUAGE_TODO reminder"; fail=1; fi
single=$(YOUTRACK_TASK_CONFIG=$tmp/missing.toml bash "$script" worktree 2>&1)
[ "$single" = "auto" ] && echo "ok single-key mode ignores the reminder line" \
|| { echo "FAIL single-key mode printed '$single', want 'auto'"; fail=1; }

cat > "$tmp/user.toml" <<'EOF'
# comment
Expand Down
Loading
Loading