@elyracode/youtrack 0.9.58 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +3 -1
- package/extensions/index.ts +44 -30
- package/package.json +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.1] - 2026-11-22
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Peer dependency on `@elyracode/coding-agent` is now `>=1.0.0`, the first version with the APIs this package uses
|
|
8
|
+
|
|
9
|
+
## [1.0.0] - 2026-11-22
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed a repository `.env` being able to set `YOUTRACK_BASE_URL` and receive the `YOUTRACK_TOKEN` from your environment. URL and token now come from the same source (both from the environment, else both from the project `.env`), and the project `.env` is only read in trusted projects
|
|
14
|
+
|
|
3
15
|
## [0.9.58] - 2026-11-18
|
|
4
16
|
|
|
5
17
|
## [0.9.57] - 2026-11-10
|
package/README.md
CHANGED
|
@@ -10,13 +10,15 @@ elyra install npm:@elyracode/youtrack
|
|
|
10
10
|
|
|
11
11
|
## Configuration
|
|
12
12
|
|
|
13
|
-
Set the following environment variables (or add
|
|
13
|
+
Set the following environment variables (or add both to your project's `.env` file):
|
|
14
14
|
|
|
15
15
|
| Variable | Description |
|
|
16
16
|
|----------|-------------|
|
|
17
17
|
| `YOUTRACK_BASE_URL` | Your YouTrack instance URL (e.g. `https://myteam.youtrack.cloud`) |
|
|
18
18
|
| `YOUTRACK_TOKEN` | Permanent token from YouTrack (Profile > Authentication > New Token) |
|
|
19
19
|
|
|
20
|
+
URL and token are always taken from the same place: both from the environment if it sets both, otherwise both from the project's `.env`. The project's `.env` is only read in [trusted projects](../coding-agent/docs/project-trust.md), so a cloned repository cannot send your token to a host of its choosing.
|
|
21
|
+
|
|
20
22
|
## Tools
|
|
21
23
|
|
|
22
24
|
| Tool | Description |
|
package/extensions/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import type { AgentToolResult, ExtensionAPI } from "@elyracode/coding-agent";
|
|
3
|
+
import type { AgentToolResult, ExtensionAPI, ExtensionContext } from "@elyracode/coding-agent";
|
|
4
4
|
import { Type } from "typebox";
|
|
5
5
|
|
|
6
6
|
// ── Configuration ───────────────────────────────────────────────────────────
|
|
@@ -29,12 +29,26 @@ function loadEnv(cwd: string): Record<string, string> {
|
|
|
29
29
|
return result;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
type EnvSource = Readonly<Record<string, string | undefined>>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Pick URL and token from one source: the process environment first, then the project's
|
|
36
|
+
* .env. Never mix them: a repository-controlled YOUTRACK_BASE_URL combined with a token from
|
|
37
|
+
* the user's environment would send that token to a host the repository chose.
|
|
38
|
+
* `projectEnv` is undefined when the project is not trusted.
|
|
39
|
+
*/
|
|
40
|
+
export function resolveYouTrackConfig(processEnv: EnvSource, projectEnv: EnvSource | undefined): YouTrackConfig | null {
|
|
41
|
+
for (const source of [processEnv, projectEnv]) {
|
|
42
|
+
const baseUrl = source?.YOUTRACK_BASE_URL;
|
|
43
|
+
const token = source?.YOUTRACK_TOKEN;
|
|
44
|
+
if (baseUrl && token) return { baseUrl: baseUrl.replace(/\/+$/, ""), token };
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function getConfig(ctx: Pick<ExtensionContext, "cwd" | "isProjectTrusted"> | undefined): YouTrackConfig | null {
|
|
50
|
+
const projectEnv = ctx?.isProjectTrusted() ? loadEnv(ctx.cwd) : undefined;
|
|
51
|
+
return resolveYouTrackConfig(process.env, projectEnv);
|
|
38
52
|
}
|
|
39
53
|
|
|
40
54
|
// ── HTTP Client ─────────────────────────────────────────────────────────────
|
|
@@ -74,7 +88,9 @@ function ok(text: string) {
|
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
function noConfig(): Error {
|
|
77
|
-
return new Error(
|
|
91
|
+
return new Error(
|
|
92
|
+
"YouTrack not configured. Set YOUTRACK_BASE_URL and YOUTRACK_TOKEN together, either in the environment or in the project's .env file (read only in trusted projects; run /trust).",
|
|
93
|
+
);
|
|
78
94
|
}
|
|
79
95
|
|
|
80
96
|
// ── Formatters ──────────────────────────────────────────────────────────────
|
|
@@ -174,14 +190,12 @@ function formatIssueList(issues: Array<Record<string, unknown>>): string {
|
|
|
174
190
|
// ── Extension ───────────────────────────────────────────────────────────────
|
|
175
191
|
|
|
176
192
|
export default function (elyra: ExtensionAPI): void {
|
|
177
|
-
let
|
|
193
|
+
let sessionCtx: ExtensionContext | undefined;
|
|
178
194
|
|
|
179
195
|
elyra.on("session_start", async (_event, ctx) => {
|
|
180
|
-
|
|
196
|
+
sessionCtx = ctx;
|
|
181
197
|
});
|
|
182
198
|
|
|
183
|
-
const getCwd = () => cwd;
|
|
184
|
-
|
|
185
199
|
const ISSUE_FIELDS =
|
|
186
200
|
"id,idReadable,summary,description,project(id,name,shortName),reporter(login,fullName),created,updated,resolved,tags(id,name),votes,customFields(id,name,projectCustomField(field(name)),value(id,name,login,fullName,minutes))";
|
|
187
201
|
const ISSUE_LIST_FIELDS = "id,idReadable,summary,resolved,customFields(name,value(name,login,fullName))";
|
|
@@ -202,7 +216,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
202
216
|
}),
|
|
203
217
|
promptSnippet: "Search YouTrack issues",
|
|
204
218
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
205
|
-
const config = getConfig(
|
|
219
|
+
const config = getConfig(sessionCtx);
|
|
206
220
|
if (!config) throw noConfig();
|
|
207
221
|
const top = Math.min(params.limit ?? 25, 100);
|
|
208
222
|
const skip = params.offset ?? 0;
|
|
@@ -229,7 +243,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
229
243
|
}),
|
|
230
244
|
promptSnippet: "Get YouTrack issue details",
|
|
231
245
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
232
|
-
const config = getConfig(
|
|
246
|
+
const config = getConfig(sessionCtx);
|
|
233
247
|
if (!config) throw noConfig();
|
|
234
248
|
const res = await ytFetch(
|
|
235
249
|
config,
|
|
@@ -274,7 +288,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
274
288
|
}),
|
|
275
289
|
promptSnippet: "Create a YouTrack issue",
|
|
276
290
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
277
|
-
const config = getConfig(
|
|
291
|
+
const config = getConfig(sessionCtx);
|
|
278
292
|
if (!config) throw noConfig();
|
|
279
293
|
const body: Record<string, unknown> = {
|
|
280
294
|
summary: params.summary,
|
|
@@ -314,7 +328,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
314
328
|
}),
|
|
315
329
|
promptSnippet: "Update a YouTrack issue",
|
|
316
330
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
317
|
-
const config = getConfig(
|
|
331
|
+
const config = getConfig(sessionCtx);
|
|
318
332
|
if (!config) throw noConfig();
|
|
319
333
|
const body: Record<string, unknown> = {};
|
|
320
334
|
if (params.summary) body.summary = params.summary;
|
|
@@ -343,7 +357,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
343
357
|
}),
|
|
344
358
|
promptSnippet: "Change YouTrack issue assignee",
|
|
345
359
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
346
|
-
const config = getConfig(
|
|
360
|
+
const config = getConfig(sessionCtx);
|
|
347
361
|
if (!config) throw noConfig();
|
|
348
362
|
const body = {
|
|
349
363
|
customFields: [
|
|
@@ -377,7 +391,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
377
391
|
}),
|
|
378
392
|
promptSnippet: "Add a comment to a YouTrack issue",
|
|
379
393
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
380
|
-
const config = getConfig(
|
|
394
|
+
const config = getConfig(sessionCtx);
|
|
381
395
|
if (!config) throw noConfig();
|
|
382
396
|
const res = await ytFetch(
|
|
383
397
|
config,
|
|
@@ -403,7 +417,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
403
417
|
}),
|
|
404
418
|
promptSnippet: "Get comments for a YouTrack issue",
|
|
405
419
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
406
|
-
const config = getConfig(
|
|
420
|
+
const config = getConfig(sessionCtx);
|
|
407
421
|
if (!config) throw noConfig();
|
|
408
422
|
const top = Math.min(params.limit ?? 25, 100);
|
|
409
423
|
const skip = params.offset ?? 0;
|
|
@@ -444,7 +458,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
444
458
|
}),
|
|
445
459
|
promptSnippet: "Add or remove a tag on a YouTrack issue",
|
|
446
460
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
447
|
-
const config = getConfig(
|
|
461
|
+
const config = getConfig(sessionCtx);
|
|
448
462
|
if (!config) throw noConfig();
|
|
449
463
|
if (params.action === "add") {
|
|
450
464
|
const res = await ytFetch(
|
|
@@ -490,7 +504,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
490
504
|
}),
|
|
491
505
|
promptSnippet: "Link two YouTrack issues",
|
|
492
506
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
493
|
-
const config = getConfig(
|
|
507
|
+
const config = getConfig(sessionCtx);
|
|
494
508
|
if (!config) throw noConfig();
|
|
495
509
|
const body = {
|
|
496
510
|
issues: [{ idReadable: params.target_issue_id }],
|
|
@@ -523,7 +537,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
523
537
|
}),
|
|
524
538
|
promptSnippet: "Find YouTrack projects",
|
|
525
539
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
526
|
-
const config = getConfig(
|
|
540
|
+
const config = getConfig(sessionCtx);
|
|
527
541
|
if (!config) throw noConfig();
|
|
528
542
|
const top = Math.min(params.limit ?? 25, 100);
|
|
529
543
|
let path = `/api/admin/projects?fields=id,name,shortName&$top=${top}`;
|
|
@@ -548,7 +562,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
548
562
|
}),
|
|
549
563
|
promptSnippet: "Get YouTrack project details",
|
|
550
564
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
551
|
-
const config = getConfig(
|
|
565
|
+
const config = getConfig(sessionCtx);
|
|
552
566
|
if (!config) throw noConfig();
|
|
553
567
|
const res = await ytFetch(
|
|
554
568
|
config,
|
|
@@ -581,7 +595,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
581
595
|
}),
|
|
582
596
|
promptSnippet: "Get YouTrack custom field schema for a project",
|
|
583
597
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
584
|
-
const config = getConfig(
|
|
598
|
+
const config = getConfig(sessionCtx);
|
|
585
599
|
if (!config) throw noConfig();
|
|
586
600
|
const res = await ytFetch(
|
|
587
601
|
config,
|
|
@@ -622,7 +636,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
622
636
|
}),
|
|
623
637
|
promptSnippet: "Find a YouTrack user",
|
|
624
638
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
625
|
-
const config = getConfig(
|
|
639
|
+
const config = getConfig(sessionCtx);
|
|
626
640
|
if (!config) throw noConfig();
|
|
627
641
|
const res = await ytFetch(
|
|
628
642
|
config,
|
|
@@ -658,7 +672,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
658
672
|
parameters: Type.Object({}),
|
|
659
673
|
promptSnippet: "Get current YouTrack user info",
|
|
660
674
|
async execute(): Promise<AgentToolResult<undefined>> {
|
|
661
|
-
const config = getConfig(
|
|
675
|
+
const config = getConfig(sessionCtx);
|
|
662
676
|
if (!config) throw noConfig();
|
|
663
677
|
const res = await ytFetch(config, "GET", "/api/users/me?fields=id,login,fullName,email,avatarUrl");
|
|
664
678
|
if (!res.ok) throw new Error(`Failed to get user (${res.status}): ${res.text}`);
|
|
@@ -684,7 +698,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
684
698
|
}),
|
|
685
699
|
promptSnippet: "Search YouTrack knowledge base articles",
|
|
686
700
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
687
|
-
const config = getConfig(
|
|
701
|
+
const config = getConfig(sessionCtx);
|
|
688
702
|
if (!config) throw noConfig();
|
|
689
703
|
const top = Math.min(params.limit ?? 25, 100);
|
|
690
704
|
const skip = params.offset ?? 0;
|
|
@@ -721,7 +735,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
721
735
|
}),
|
|
722
736
|
promptSnippet: "Get a YouTrack knowledge base article",
|
|
723
737
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
724
|
-
const config = getConfig(
|
|
738
|
+
const config = getConfig(sessionCtx);
|
|
725
739
|
if (!config) throw noConfig();
|
|
726
740
|
const res = await ytFetch(
|
|
727
741
|
config,
|
|
@@ -766,7 +780,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
766
780
|
}),
|
|
767
781
|
promptSnippet: "Create a YouTrack knowledge base article",
|
|
768
782
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
769
|
-
const config = getConfig(
|
|
783
|
+
const config = getConfig(sessionCtx);
|
|
770
784
|
if (!config) throw noConfig();
|
|
771
785
|
const body: Record<string, unknown> = {
|
|
772
786
|
summary: params.summary,
|
|
@@ -803,7 +817,7 @@ export default function (elyra: ExtensionAPI): void {
|
|
|
803
817
|
}),
|
|
804
818
|
promptSnippet: "Log work time on a YouTrack issue",
|
|
805
819
|
async execute(_id, params): Promise<AgentToolResult<undefined>> {
|
|
806
|
-
const config = getConfig(
|
|
820
|
+
const config = getConfig(sessionCtx);
|
|
807
821
|
if (!config) throw noConfig();
|
|
808
822
|
const body: Record<string, unknown> = {
|
|
809
823
|
duration: { minutes: params.minutes },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elyracode/youtrack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "YouTrack integration for Elyra -- search issues, manage assignments, comments, projects, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -25,13 +25,20 @@
|
|
|
25
25
|
"./skills"
|
|
26
26
|
]
|
|
27
27
|
},
|
|
28
|
+
"files": [
|
|
29
|
+
"extensions",
|
|
30
|
+
"skills",
|
|
31
|
+
"README.md",
|
|
32
|
+
"CHANGELOG.md"
|
|
33
|
+
],
|
|
28
34
|
"peerDependencies": {
|
|
29
|
-
"@elyracode/coding-agent": "
|
|
35
|
+
"@elyracode/coding-agent": ">=1.0.0",
|
|
30
36
|
"typebox": "*"
|
|
31
37
|
},
|
|
32
38
|
"scripts": {
|
|
33
39
|
"clean": "echo 'nothing to clean'",
|
|
34
40
|
"build": "echo 'nothing to build'",
|
|
35
|
-
"check": "echo 'nothing to check'"
|
|
41
|
+
"check": "echo 'nothing to check'",
|
|
42
|
+
"test": "vitest --run"
|
|
36
43
|
}
|
|
37
44
|
}
|