ya-git-jira 1.5.0 → 2.0.0
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/.opencode/skills/architecture/SKILL.md +45 -0
- package/.opencode/skills/code-style/SKILL.md +76 -0
- package/.opencode/skills/git-confluence/SKILL.md +82 -0
- package/.opencode/skills/git-jira/SKILL.md +63 -0
- package/.opencode/skills/git-lab/SKILL.md +102 -0
- package/AGENTS.md +50 -0
- package/README.md +121 -71
- package/bin/git-api.ts +70 -0
- package/bin/git-confluence-page-search.ts +58 -0
- package/bin/git-confluence-page-show.ts +61 -0
- package/bin/git-confluence-page-update.ts +77 -0
- package/bin/git-confluence-page.ts +28 -0
- package/bin/git-confluence-space-list.ts +34 -0
- package/bin/git-confluence-space.ts +24 -0
- package/bin/git-confluence-whoami.ts +33 -0
- package/bin/git-confluence.ts +27 -0
- package/bin/git-jira-start.ts +1 -1
- package/bin/git-jira-whoami.ts +32 -0
- package/bin/git-jira.ts +2 -0
- package/bin/git-lab-project-mr-list.ts +57 -0
- package/bin/git-lab-project-mr.ts +24 -0
- package/bin/git-lab-project-pipeline-jobs.ts +46 -0
- package/bin/git-lab-project-pipeline-latest.ts +47 -0
- package/bin/git-lab-project-pipeline-log.ts +49 -0
- package/bin/git-lab-project-pipeline.ts +6 -0
- package/bin/git-lab-project.ts +5 -1
- package/bin/gitj-install-skills.ts +126 -0
- package/bin/gitj.ts +12 -0
- package/dist/bin/git-api.js +2156 -0
- package/dist/bin/git-bump.js +136 -125
- package/dist/bin/git-confluence-page-search.js +2079 -0
- package/dist/bin/{git-lab-projects.js → git-confluence-page-show.js} +294 -250
- package/dist/bin/{git-lab-projects-whereami.js → git-confluence-page-update.js} +300 -206
- package/dist/bin/git-confluence-page.js +2186 -0
- package/dist/bin/{git-lab-groups.js → git-confluence-space-list.js} +279 -210
- package/dist/bin/git-confluence-space.js +2073 -0
- package/dist/bin/git-confluence-whoami.js +2060 -0
- package/dist/bin/git-confluence.js +2251 -0
- package/dist/bin/git-jira-issue-list.js +144 -129
- package/dist/bin/git-jira-issue-show.js +144 -129
- package/dist/bin/git-jira-issue.js +148 -133
- package/dist/bin/git-jira-start.js +146 -131
- package/dist/bin/{git-lab-namespaces.js → git-jira-whoami.js} +214 -226
- package/dist/bin/git-jira.js +178 -143
- package/dist/bin/git-lab-group-list.js +326 -394
- package/dist/bin/git-lab-group.js +328 -396
- package/dist/bin/git-lab-merge-active.js +326 -394
- package/dist/bin/git-lab-merge-todo.js +326 -394
- package/dist/bin/git-lab-merge-train-list.js +294 -388
- package/dist/bin/git-lab-merge-train.js +296 -390
- package/dist/bin/git-lab-merge.js +335 -403
- package/dist/bin/git-lab-namespace-list.js +145 -135
- package/dist/bin/git-lab-namespace.js +147 -137
- package/dist/bin/git-lab-project-list.js +293 -387
- package/dist/bin/git-lab-project-mr-list.js +2740 -0
- package/dist/bin/git-lab-project-mr.js +2752 -0
- package/dist/bin/git-lab-project-pipeline-jobs.js +2734 -0
- package/dist/bin/git-lab-project-pipeline-latest.js +2736 -0
- package/dist/bin/git-lab-project-pipeline-list.js +328 -396
- package/dist/bin/git-lab-project-pipeline-log.js +2739 -0
- package/dist/bin/git-lab-project-pipeline.js +442 -407
- package/dist/bin/git-lab-project-whereami.js +297 -391
- package/dist/bin/git-lab-project.js +568 -403
- package/dist/bin/git-lab-whoami.js +149 -139
- package/dist/bin/git-lab.js +581 -454
- package/dist/bin/{git-lab-projects-list.js → gitj-install-skills.js} +226 -268
- package/dist/bin/gitj.js +1384 -578
- package/dist/index.js +379 -300
- package/index.ts +1 -0
- package/lib/api.ts +177 -0
- package/lib/confluence/api.ts +132 -0
- package/lib/confluence/config.ts +25 -0
- package/lib/confluence/index.ts +3 -0
- package/lib/confluence/types.ts +59 -0
- package/lib/git.ts +3 -3
- package/lib/gitlab/config.ts +5 -5
- package/lib/gitlab/index.ts +1 -0
- package/lib/gitlab/job.ts +31 -0
- package/lib/gitlab/merge-request.ts +20 -0
- package/lib/gitlab/pipeline.ts +28 -1
- package/lib/gitlab/project.ts +14 -5
- package/lib/help.ts +40 -0
- package/lib/jira.ts +11 -6
- package/lib/spawn.ts +3 -3
- package/package.json +18 -2
- package/tests/all-help.test.ts +6 -1
- package/tests/gitj.test.ts +1 -1
- package/tests/help-all.test.ts +29 -0
- package/bun.lockb +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getProtoOf = Object.getPrototypeOf;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __toESM = (mod, isNodeMode, target) => {
|
|
@@ -17,11 +17,9 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
20
|
-
var __require =
|
|
21
|
-
return import.meta.require(id);
|
|
22
|
-
};
|
|
20
|
+
var __require = import.meta.require;
|
|
23
21
|
|
|
24
|
-
//
|
|
22
|
+
// node_modules/commander/lib/error.js
|
|
25
23
|
var require_error = __commonJS((exports) => {
|
|
26
24
|
class CommanderError extends Error {
|
|
27
25
|
constructor(exitCode, code, message) {
|
|
@@ -45,12 +43,8 @@ var require_error = __commonJS((exports) => {
|
|
|
45
43
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
46
44
|
});
|
|
47
45
|
|
|
48
|
-
//
|
|
46
|
+
// node_modules/commander/lib/argument.js
|
|
49
47
|
var require_argument = __commonJS((exports) => {
|
|
50
|
-
var humanReadableArgName = function(arg) {
|
|
51
|
-
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
52
|
-
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
53
|
-
};
|
|
54
48
|
var { InvalidArgumentError } = require_error();
|
|
55
49
|
|
|
56
50
|
class Argument {
|
|
@@ -120,11 +114,15 @@ var require_argument = __commonJS((exports) => {
|
|
|
120
114
|
return this;
|
|
121
115
|
}
|
|
122
116
|
}
|
|
117
|
+
function humanReadableArgName(arg) {
|
|
118
|
+
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
119
|
+
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
120
|
+
}
|
|
123
121
|
exports.Argument = Argument;
|
|
124
122
|
exports.humanReadableArgName = humanReadableArgName;
|
|
125
123
|
});
|
|
126
124
|
|
|
127
|
-
//
|
|
125
|
+
// node_modules/commander/lib/help.js
|
|
128
126
|
var require_help = __commonJS((exports) => {
|
|
129
127
|
var { humanReadableArgName } = require_argument();
|
|
130
128
|
|
|
@@ -301,7 +299,8 @@ var require_help = __commonJS((exports) => {
|
|
|
301
299
|
return term;
|
|
302
300
|
}
|
|
303
301
|
function formatList(textArray) {
|
|
304
|
-
return textArray.join(
|
|
302
|
+
return textArray.join(`
|
|
303
|
+
`).replace(/^/gm, " ".repeat(itemIndentWidth));
|
|
305
304
|
}
|
|
306
305
|
let output = [`Usage: ${helper.commandUsage(cmd)}`, ""];
|
|
307
306
|
const commandDescription = helper.commandDescription(cmd);
|
|
@@ -334,7 +333,8 @@ var require_help = __commonJS((exports) => {
|
|
|
334
333
|
if (commandList.length > 0) {
|
|
335
334
|
output = output.concat(["Commands:", formatList(commandList), ""]);
|
|
336
335
|
}
|
|
337
|
-
return output.join(
|
|
336
|
+
return output.join(`
|
|
337
|
+
`);
|
|
338
338
|
}
|
|
339
339
|
padWidth(cmd, helper) {
|
|
340
340
|
return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
|
|
@@ -348,42 +348,29 @@ var require_help = __commonJS((exports) => {
|
|
|
348
348
|
if (columnWidth < minColumnWidth)
|
|
349
349
|
return str;
|
|
350
350
|
const leadingStr = str.slice(0, indent);
|
|
351
|
-
const columnText = str.slice(indent).replace(
|
|
351
|
+
const columnText = str.slice(indent).replace(`\r
|
|
352
|
+
`, `
|
|
353
|
+
`);
|
|
352
354
|
const indentString = " ".repeat(indent);
|
|
353
355
|
const zeroWidthSpace = "\u200B";
|
|
354
356
|
const breaks = `\\s${zeroWidthSpace}`;
|
|
355
|
-
const regex = new RegExp(
|
|
357
|
+
const regex = new RegExp(`
|
|
358
|
+
|.{1,${columnWidth - 1}}([${breaks}]|$)|[^${breaks}]+?([${breaks}]|$)`, "g");
|
|
356
359
|
const lines = columnText.match(regex) || [];
|
|
357
360
|
return leadingStr + lines.map((line, i) => {
|
|
358
|
-
if (line ===
|
|
361
|
+
if (line === `
|
|
362
|
+
`)
|
|
359
363
|
return "";
|
|
360
364
|
return (i > 0 ? indentString : "") + line.trimEnd();
|
|
361
|
-
}).join(
|
|
365
|
+
}).join(`
|
|
366
|
+
`);
|
|
362
367
|
}
|
|
363
368
|
}
|
|
364
369
|
exports.Help = Help;
|
|
365
370
|
});
|
|
366
371
|
|
|
367
|
-
//
|
|
372
|
+
// node_modules/commander/lib/option.js
|
|
368
373
|
var require_option = __commonJS((exports) => {
|
|
369
|
-
var camelcase = function(str) {
|
|
370
|
-
return str.split("-").reduce((str2, word) => {
|
|
371
|
-
return str2 + word[0].toUpperCase() + word.slice(1);
|
|
372
|
-
});
|
|
373
|
-
};
|
|
374
|
-
var splitOptionFlags = function(flags) {
|
|
375
|
-
let shortFlag;
|
|
376
|
-
let longFlag;
|
|
377
|
-
const flagParts = flags.split(/[ |,]+/);
|
|
378
|
-
if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))
|
|
379
|
-
shortFlag = flagParts.shift();
|
|
380
|
-
longFlag = flagParts.shift();
|
|
381
|
-
if (!shortFlag && /^-[^-]$/.test(longFlag)) {
|
|
382
|
-
shortFlag = longFlag;
|
|
383
|
-
longFlag = undefined;
|
|
384
|
-
}
|
|
385
|
-
return { shortFlag, longFlag };
|
|
386
|
-
};
|
|
387
374
|
var { InvalidArgumentError } = require_error();
|
|
388
375
|
|
|
389
376
|
class Option {
|
|
@@ -511,14 +498,33 @@ var require_option = __commonJS((exports) => {
|
|
|
511
498
|
return option.negate === (negativeValue === value);
|
|
512
499
|
}
|
|
513
500
|
}
|
|
501
|
+
function camelcase(str) {
|
|
502
|
+
return str.split("-").reduce((str2, word) => {
|
|
503
|
+
return str2 + word[0].toUpperCase() + word.slice(1);
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
function splitOptionFlags(flags) {
|
|
507
|
+
let shortFlag;
|
|
508
|
+
let longFlag;
|
|
509
|
+
const flagParts = flags.split(/[ |,]+/);
|
|
510
|
+
if (flagParts.length > 1 && !/^[[<]/.test(flagParts[1]))
|
|
511
|
+
shortFlag = flagParts.shift();
|
|
512
|
+
longFlag = flagParts.shift();
|
|
513
|
+
if (!shortFlag && /^-[^-]$/.test(longFlag)) {
|
|
514
|
+
shortFlag = longFlag;
|
|
515
|
+
longFlag = undefined;
|
|
516
|
+
}
|
|
517
|
+
return { shortFlag, longFlag };
|
|
518
|
+
}
|
|
514
519
|
exports.Option = Option;
|
|
515
520
|
exports.splitOptionFlags = splitOptionFlags;
|
|
516
521
|
exports.DualOptions = DualOptions;
|
|
517
522
|
});
|
|
518
523
|
|
|
519
|
-
//
|
|
524
|
+
// node_modules/commander/lib/suggestSimilar.js
|
|
520
525
|
var require_suggestSimilar = __commonJS((exports) => {
|
|
521
|
-
var
|
|
526
|
+
var maxDistance = 3;
|
|
527
|
+
function editDistance(a, b) {
|
|
522
528
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
523
529
|
return Math.max(a.length, b.length);
|
|
524
530
|
const d = [];
|
|
@@ -543,8 +549,8 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
543
549
|
}
|
|
544
550
|
}
|
|
545
551
|
return d[a.length][b.length];
|
|
546
|
-
}
|
|
547
|
-
|
|
552
|
+
}
|
|
553
|
+
function suggestSimilar(word, candidates) {
|
|
548
554
|
if (!candidates || candidates.length === 0)
|
|
549
555
|
return "";
|
|
550
556
|
candidates = Array.from(new Set(candidates));
|
|
@@ -576,67 +582,25 @@ var require_suggestSimilar = __commonJS((exports) => {
|
|
|
576
582
|
similar = similar.map((candidate) => `--${candidate}`);
|
|
577
583
|
}
|
|
578
584
|
if (similar.length > 1) {
|
|
579
|
-
return
|
|
585
|
+
return `
|
|
586
|
+
(Did you mean one of ${similar.join(", ")}?)`;
|
|
580
587
|
}
|
|
581
588
|
if (similar.length === 1) {
|
|
582
|
-
return
|
|
589
|
+
return `
|
|
590
|
+
(Did you mean ${similar[0]}?)`;
|
|
583
591
|
}
|
|
584
592
|
return "";
|
|
585
|
-
}
|
|
586
|
-
var maxDistance = 3;
|
|
593
|
+
}
|
|
587
594
|
exports.suggestSimilar = suggestSimilar;
|
|
588
595
|
});
|
|
589
596
|
|
|
590
|
-
//
|
|
597
|
+
// node_modules/commander/lib/command.js
|
|
591
598
|
var require_command = __commonJS((exports) => {
|
|
592
|
-
var
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
var incrementNodeInspectorPort = function(args) {
|
|
600
|
-
return args.map((arg) => {
|
|
601
|
-
if (!arg.startsWith("--inspect")) {
|
|
602
|
-
return arg;
|
|
603
|
-
}
|
|
604
|
-
let debugOption;
|
|
605
|
-
let debugHost = "127.0.0.1";
|
|
606
|
-
let debugPort = "9229";
|
|
607
|
-
let match;
|
|
608
|
-
if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
|
|
609
|
-
debugOption = match[1];
|
|
610
|
-
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
|
|
611
|
-
debugOption = match[1];
|
|
612
|
-
if (/^\d+$/.test(match[3])) {
|
|
613
|
-
debugPort = match[3];
|
|
614
|
-
} else {
|
|
615
|
-
debugHost = match[3];
|
|
616
|
-
}
|
|
617
|
-
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
|
|
618
|
-
debugOption = match[1];
|
|
619
|
-
debugHost = match[3];
|
|
620
|
-
debugPort = match[4];
|
|
621
|
-
}
|
|
622
|
-
if (debugOption && debugPort !== "0") {
|
|
623
|
-
return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
|
|
624
|
-
}
|
|
625
|
-
return arg;
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
var getCommandAndParents = function(startCommand) {
|
|
629
|
-
const result = [];
|
|
630
|
-
for (let command = startCommand;command; command = command.parent) {
|
|
631
|
-
result.push(command);
|
|
632
|
-
}
|
|
633
|
-
return result;
|
|
634
|
-
};
|
|
635
|
-
var EventEmitter = import.meta.require("events").EventEmitter;
|
|
636
|
-
var childProcess = import.meta.require("child_process");
|
|
637
|
-
var path = import.meta.require("path");
|
|
638
|
-
var fs = import.meta.require("fs");
|
|
639
|
-
var process2 = import.meta.require("process");
|
|
599
|
+
var EventEmitter = __require("events").EventEmitter;
|
|
600
|
+
var childProcess = __require("child_process");
|
|
601
|
+
var path = __require("path");
|
|
602
|
+
var fs = __require("fs");
|
|
603
|
+
var process2 = __require("process");
|
|
640
604
|
var { Argument, humanReadableArgName } = require_argument();
|
|
641
605
|
var { CommanderError } = require_error();
|
|
642
606
|
var { Help } = require_help();
|
|
@@ -853,8 +817,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
853
817
|
this._exitCallback = (err) => {
|
|
854
818
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
855
819
|
throw err;
|
|
856
|
-
} else {
|
|
857
|
-
}
|
|
820
|
+
} else {}
|
|
858
821
|
};
|
|
859
822
|
}
|
|
860
823
|
return this;
|
|
@@ -1491,11 +1454,14 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1491
1454
|
return getCommandAndParents(this).reduce((combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()), {});
|
|
1492
1455
|
}
|
|
1493
1456
|
error(message, errorOptions) {
|
|
1494
|
-
this._outputConfiguration.outputError(`${message}
|
|
1457
|
+
this._outputConfiguration.outputError(`${message}
|
|
1458
|
+
`, this._outputConfiguration.writeErr);
|
|
1495
1459
|
if (typeof this._showHelpAfterError === "string") {
|
|
1496
|
-
this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
1460
|
+
this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
1461
|
+
`);
|
|
1497
1462
|
} else if (this._showHelpAfterError) {
|
|
1498
|
-
this._outputConfiguration.writeErr(
|
|
1463
|
+
this._outputConfiguration.writeErr(`
|
|
1464
|
+
`);
|
|
1499
1465
|
this.outputHelp({ error: true });
|
|
1500
1466
|
}
|
|
1501
1467
|
const config = errorOptions || {};
|
|
@@ -1505,7 +1471,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1505
1471
|
}
|
|
1506
1472
|
_parseOptionsEnv() {
|
|
1507
1473
|
this.options.forEach((option) => {
|
|
1508
|
-
if (option.envVar &&
|
|
1474
|
+
if (option.envVar && option.envVar in process2.env) {
|
|
1509
1475
|
const optionKey = option.attributeName();
|
|
1510
1476
|
if (this.getOptionValue(optionKey) === undefined || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
|
|
1511
1477
|
if (option.required || option.optional) {
|
|
@@ -1614,7 +1580,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1614
1580
|
this._versionOptionName = versionOption.attributeName();
|
|
1615
1581
|
this.options.push(versionOption);
|
|
1616
1582
|
this.on("option:" + versionOption.name(), () => {
|
|
1617
|
-
this._outputConfiguration.writeOut(`${str}
|
|
1583
|
+
this._outputConfiguration.writeOut(`${str}
|
|
1584
|
+
`);
|
|
1618
1585
|
this._exit(0, "commander.version", str);
|
|
1619
1586
|
});
|
|
1620
1587
|
return this;
|
|
@@ -1642,7 +1609,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1642
1609
|
command = this.commands[this.commands.length - 1];
|
|
1643
1610
|
}
|
|
1644
1611
|
if (alias === command._name)
|
|
1645
|
-
throw new Error("Command alias can
|
|
1612
|
+
throw new Error("Command alias can't be the same as its name");
|
|
1646
1613
|
command._aliases.push(alias);
|
|
1647
1614
|
return this;
|
|
1648
1615
|
}
|
|
@@ -1756,16 +1723,60 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1756
1723
|
helpStr = text;
|
|
1757
1724
|
}
|
|
1758
1725
|
if (helpStr) {
|
|
1759
|
-
context.write(`${helpStr}
|
|
1726
|
+
context.write(`${helpStr}
|
|
1727
|
+
`);
|
|
1760
1728
|
}
|
|
1761
1729
|
});
|
|
1762
1730
|
return this;
|
|
1763
1731
|
}
|
|
1764
1732
|
}
|
|
1733
|
+
function outputHelpIfRequested(cmd, args) {
|
|
1734
|
+
const helpOption = cmd._hasHelpOption && args.find((arg) => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag);
|
|
1735
|
+
if (helpOption) {
|
|
1736
|
+
cmd.outputHelp();
|
|
1737
|
+
cmd._exit(0, "commander.helpDisplayed", "(outputHelp)");
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
function incrementNodeInspectorPort(args) {
|
|
1741
|
+
return args.map((arg) => {
|
|
1742
|
+
if (!arg.startsWith("--inspect")) {
|
|
1743
|
+
return arg;
|
|
1744
|
+
}
|
|
1745
|
+
let debugOption;
|
|
1746
|
+
let debugHost = "127.0.0.1";
|
|
1747
|
+
let debugPort = "9229";
|
|
1748
|
+
let match;
|
|
1749
|
+
if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
|
|
1750
|
+
debugOption = match[1];
|
|
1751
|
+
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
|
|
1752
|
+
debugOption = match[1];
|
|
1753
|
+
if (/^\d+$/.test(match[3])) {
|
|
1754
|
+
debugPort = match[3];
|
|
1755
|
+
} else {
|
|
1756
|
+
debugHost = match[3];
|
|
1757
|
+
}
|
|
1758
|
+
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
|
|
1759
|
+
debugOption = match[1];
|
|
1760
|
+
debugHost = match[3];
|
|
1761
|
+
debugPort = match[4];
|
|
1762
|
+
}
|
|
1763
|
+
if (debugOption && debugPort !== "0") {
|
|
1764
|
+
return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
|
|
1765
|
+
}
|
|
1766
|
+
return arg;
|
|
1767
|
+
});
|
|
1768
|
+
}
|
|
1769
|
+
function getCommandAndParents(startCommand) {
|
|
1770
|
+
const result = [];
|
|
1771
|
+
for (let command = startCommand;command; command = command.parent) {
|
|
1772
|
+
result.push(command);
|
|
1773
|
+
}
|
|
1774
|
+
return result;
|
|
1775
|
+
}
|
|
1765
1776
|
exports.Command = Command;
|
|
1766
1777
|
});
|
|
1767
1778
|
|
|
1768
|
-
//
|
|
1779
|
+
// node_modules/commander/index.js
|
|
1769
1780
|
var require_commander = __commonJS((exports, module) => {
|
|
1770
1781
|
var { Argument } = require_argument();
|
|
1771
1782
|
var { Command } = require_command();
|
|
@@ -1783,8 +1794,8 @@ var require_commander = __commonJS((exports, module) => {
|
|
|
1783
1794
|
exports.Option = Option;
|
|
1784
1795
|
});
|
|
1785
1796
|
|
|
1786
|
-
//
|
|
1787
|
-
var
|
|
1797
|
+
// node_modules/commander/esm.mjs
|
|
1798
|
+
var import__ = __toESM(require_commander(), 1);
|
|
1788
1799
|
var {
|
|
1789
1800
|
program,
|
|
1790
1801
|
createCommand,
|
|
@@ -1797,166 +1808,44 @@ var {
|
|
|
1797
1808
|
Argument,
|
|
1798
1809
|
Option,
|
|
1799
1810
|
Help
|
|
1800
|
-
} =
|
|
1811
|
+
} = import__.default;
|
|
1801
1812
|
|
|
1802
|
-
//
|
|
1803
|
-
async function spawn(args, options = defaultOptions) {
|
|
1804
|
-
const proc = Bun.spawn(args, { stdout: "pipe", stderr: "pipe" });
|
|
1805
|
-
const stdout = new Response(proc.stdout);
|
|
1806
|
-
const stderr = new Response(proc.stderr);
|
|
1807
|
-
const [out, err, exitCode, signal] = await Promise.all([stdout.text(), stderr.text(), proc.exitCode, proc.signalCode]);
|
|
1808
|
-
let code = 0;
|
|
1809
|
-
if (exitCode !== null) {
|
|
1810
|
-
code = exitCode;
|
|
1811
|
-
}
|
|
1812
|
-
if (!out && !err && !options.expectQuiet) {
|
|
1813
|
-
console.warn(`No output from ${args.join(" ")}`);
|
|
1814
|
-
}
|
|
1815
|
-
return { out: out.trim(), err: err.trim(), code };
|
|
1816
|
-
}
|
|
1817
|
-
async function doCommand(args) {
|
|
1818
|
-
const { out, err } = await spawn(args);
|
|
1819
|
-
if (err)
|
|
1820
|
-
console.error(err);
|
|
1821
|
-
return out;
|
|
1822
|
-
}
|
|
1823
|
-
var defaultOptions = {
|
|
1824
|
-
expectQuiet: false
|
|
1825
|
-
};
|
|
1826
|
-
|
|
1827
|
-
// bine_modul
|
|
1828
|
-
async function getConfig(key) {
|
|
1829
|
-
return doCommand(["git", "config", "--get", key]);
|
|
1830
|
-
}
|
|
1831
|
-
async function createBranch(name) {
|
|
1832
|
-
return doCommand(["git", "checkout", "-b", name]);
|
|
1833
|
-
}
|
|
1834
|
-
async function getCurrentBranch() {
|
|
1835
|
-
return doCommand(["git", "rev-parse", "--abbrev-ref", "HEAD"]);
|
|
1836
|
-
}
|
|
1837
|
-
async function getRemote() {
|
|
1838
|
-
return doCommand(["git", "ls-remote", "--get-url", "origin"]);
|
|
1839
|
-
}
|
|
1840
|
-
|
|
1841
|
-
// bine_modules/
|
|
1813
|
+
// lib/package.ts
|
|
1842
1814
|
import path from "path";
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
return { host, user, token };
|
|
1854
|
-
}
|
|
1855
|
-
var getNextLink = function(link) {
|
|
1856
|
-
if (!link) {
|
|
1857
|
-
return;
|
|
1858
|
-
}
|
|
1859
|
-
const regex = /<([^>]+)>; rel="next"/;
|
|
1860
|
-
const match = link.match(regex);
|
|
1861
|
-
const next = match ? match[1] : undefined;
|
|
1862
|
-
return next;
|
|
1863
|
-
};
|
|
1864
|
-
async function gitlabApi(endpoint) {
|
|
1865
|
-
const method = "GET";
|
|
1866
|
-
const { host, token } = await getGitlabConfig();
|
|
1867
|
-
const base = `https://${host}/api/v4`;
|
|
1868
|
-
const requested = 100;
|
|
1869
|
-
const sep = endpoint.includes("?") ? "&" : "?";
|
|
1870
|
-
const uri = `${base}/${endpoint}${sep}per_page=${requested}`;
|
|
1871
|
-
const headers = new Headers;
|
|
1872
|
-
headers.append("Accept", "application/json");
|
|
1873
|
-
headers.append("Private-Token", token);
|
|
1874
|
-
const options = {
|
|
1875
|
-
method,
|
|
1876
|
-
headers
|
|
1877
|
-
};
|
|
1878
|
-
let request = new Request(uri, options);
|
|
1879
|
-
const response = await fetch(request);
|
|
1880
|
-
let link = getNextLink(response.headers.get("Link"));
|
|
1881
|
-
let partial = await response.json();
|
|
1882
|
-
let result = partial;
|
|
1883
|
-
while (partial.length == requested && link) {
|
|
1884
|
-
let request2 = new Request(link, options);
|
|
1885
|
-
const next_response = await fetch(request2);
|
|
1886
|
-
link = getNextLink(next_response.headers.get("Link"));
|
|
1887
|
-
partial = await next_response.json();
|
|
1888
|
-
result = result.concat(partial);
|
|
1889
|
-
}
|
|
1890
|
-
return result;
|
|
1891
|
-
}
|
|
1892
|
-
async function whoami() {
|
|
1893
|
-
return await gitlabApi("/user");
|
|
1894
|
-
}
|
|
1895
|
-
async function getProjects(match) {
|
|
1896
|
-
const projects = await gitlabApi(`/projects?membership=true&simple=true`);
|
|
1897
|
-
if (!projects) {
|
|
1898
|
-
throw new Error(`No projects!`);
|
|
1899
|
-
} else if (!Array.isArray(projects)) {
|
|
1900
|
-
console.log(projects);
|
|
1901
|
-
throw new Error(`Projects is not an array!`);
|
|
1902
|
-
}
|
|
1903
|
-
const projs = projects;
|
|
1904
|
-
console.log(`Searching within a set of ${projs.length} projects for ${match}`);
|
|
1905
|
-
const filtered = projs.filter((p) => {
|
|
1906
|
-
return p.path_with_namespace.toLowerCase().includes(match.toLowerCase());
|
|
1907
|
-
});
|
|
1908
|
-
return filtered;
|
|
1909
|
-
}
|
|
1910
|
-
async function findProject(ssh_url) {
|
|
1911
|
-
const parts = ssh_url.split(":");
|
|
1912
|
-
if (parts.length != 2) {
|
|
1913
|
-
throw new Error(`${ssh_url} is invalid, could not be split into two parts at :`);
|
|
1815
|
+
import fs from "fs";
|
|
1816
|
+
function findPackageJson() {
|
|
1817
|
+
const cwd = import.meta.dir;
|
|
1818
|
+
let dir = cwd;
|
|
1819
|
+
while (dir !== "/") {
|
|
1820
|
+
const packageJson = path.join(dir, "package.json");
|
|
1821
|
+
if (fs.existsSync(packageJson)) {
|
|
1822
|
+
return packageJson;
|
|
1823
|
+
}
|
|
1824
|
+
dir = path.dirname(dir);
|
|
1914
1825
|
}
|
|
1915
|
-
|
|
1916
|
-
const projects = await getProjects(name);
|
|
1917
|
-
const project = projects.find((p) => {
|
|
1918
|
-
return p.ssh_url_to_repo === ssh_url;
|
|
1919
|
-
});
|
|
1920
|
-
return project;
|
|
1826
|
+
return null;
|
|
1921
1827
|
}
|
|
1922
|
-
async function
|
|
1923
|
-
const
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
const project = await findProject(remote);
|
|
1927
|
-
if (!project) {
|
|
1928
|
-
throw new Error(`Could not find project for remote ${remote}`);
|
|
1828
|
+
async function getPackageJson() {
|
|
1829
|
+
const packagePath = findPackageJson();
|
|
1830
|
+
if (!packagePath) {
|
|
1831
|
+
throw new Error(`No package.json found in ${import.meta.dir} or any parent directory`);
|
|
1929
1832
|
}
|
|
1930
|
-
const
|
|
1931
|
-
|
|
1932
|
-
const headers = new Headers;
|
|
1933
|
-
headers.append("Accept", "application/json");
|
|
1934
|
-
headers.append("Private-Token", token);
|
|
1935
|
-
const options = {
|
|
1936
|
-
method,
|
|
1937
|
-
headers
|
|
1938
|
-
};
|
|
1939
|
-
const request = new Request(uri, options);
|
|
1940
|
-
const response = await fetch(request);
|
|
1941
|
-
return await response.json();
|
|
1942
|
-
}
|
|
1943
|
-
async function getMergeRequest(id) {
|
|
1944
|
-
return await projectScopedGet(`/merge_requests/${id}`);
|
|
1833
|
+
const packageJsonText = fs.readFileSync(packagePath, "utf8");
|
|
1834
|
+
return JSON.parse(packageJsonText);
|
|
1945
1835
|
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
return await gitlabApi(`/groups`);
|
|
1836
|
+
var packageJsonPromise = getPackageJson();
|
|
1837
|
+
async function getPackageVersion() {
|
|
1838
|
+
const packageJson = await packageJsonPromise;
|
|
1839
|
+
return packageJson.version;
|
|
1951
1840
|
}
|
|
1952
1841
|
|
|
1953
|
-
//
|
|
1842
|
+
// lib/is_main.ts
|
|
1954
1843
|
import path2 from "path";
|
|
1955
|
-
|
|
1844
|
+
function justBase(filename) {
|
|
1956
1845
|
const ext = path2.extname(filename);
|
|
1957
1846
|
const base = path2.basename(filename, ext);
|
|
1958
1847
|
return base;
|
|
1959
|
-
}
|
|
1848
|
+
}
|
|
1960
1849
|
function isMain(self) {
|
|
1961
1850
|
const arg1 = Bun.argv[1];
|
|
1962
1851
|
const argv1Base = justBase(arg1);
|
|
@@ -1965,32 +1854,101 @@ function isMain(self) {
|
|
|
1965
1854
|
return result;
|
|
1966
1855
|
}
|
|
1967
1856
|
|
|
1968
|
-
//
|
|
1857
|
+
// bin/gitj-install-skills.ts
|
|
1858
|
+
import fs2 from "fs";
|
|
1859
|
+
import path3 from "path";
|
|
1860
|
+
import os from "os";
|
|
1861
|
+
var version = await getPackageVersion();
|
|
1862
|
+
var frameworks = ["opencode", "copilot", "claude"];
|
|
1863
|
+
var skillNames = ["git-jira", "git-lab", "git-confluence"];
|
|
1864
|
+
function getSkillsSourceDir() {
|
|
1865
|
+
const packageJsonPath = findPackageJson();
|
|
1866
|
+
if (!packageJsonPath) {
|
|
1867
|
+
throw new Error("Cannot find package.json for ya-git-jira");
|
|
1868
|
+
}
|
|
1869
|
+
const packageRoot = path3.dirname(packageJsonPath);
|
|
1870
|
+
const skillsDir = path3.join(packageRoot, ".opencode", "skills");
|
|
1871
|
+
if (!fs2.existsSync(skillsDir)) {
|
|
1872
|
+
throw new Error(`Skills directory not found: ${skillsDir}`);
|
|
1873
|
+
}
|
|
1874
|
+
return skillsDir;
|
|
1875
|
+
}
|
|
1876
|
+
function getTargetDir(framework) {
|
|
1877
|
+
const home = os.homedir();
|
|
1878
|
+
switch (framework) {
|
|
1879
|
+
case "opencode":
|
|
1880
|
+
return path3.join(home, ".config", "opencode", "skills");
|
|
1881
|
+
case "copilot":
|
|
1882
|
+
return path3.join(home, ".copilot", "skills");
|
|
1883
|
+
case "claude":
|
|
1884
|
+
return path3.join(process.cwd(), ".claude", "skills");
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
function installSkills(framework, copy) {
|
|
1888
|
+
const sourceDir = getSkillsSourceDir();
|
|
1889
|
+
const targetDir = getTargetDir(framework);
|
|
1890
|
+
fs2.mkdirSync(targetDir, { recursive: true });
|
|
1891
|
+
for (const name of skillNames) {
|
|
1892
|
+
const source = path3.join(sourceDir, name);
|
|
1893
|
+
const target = path3.join(targetDir, name);
|
|
1894
|
+
if (fs2.existsSync(target)) {
|
|
1895
|
+
const stat = fs2.lstatSync(target);
|
|
1896
|
+
if (stat.isSymbolicLink()) {
|
|
1897
|
+
fs2.unlinkSync(target);
|
|
1898
|
+
} else if (stat.isDirectory()) {
|
|
1899
|
+
console.error(`${target} already exists as a directory -- skipping (use --force to overwrite)`);
|
|
1900
|
+
continue;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
if (copy) {
|
|
1904
|
+
fs2.cpSync(source, target, { recursive: true });
|
|
1905
|
+
console.log(`copied ${name} -> ${target}`);
|
|
1906
|
+
} else {
|
|
1907
|
+
fs2.symlinkSync(source, target);
|
|
1908
|
+
console.log(`linked ${name} -> ${target}`);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
function forceInstallSkills(framework, copy) {
|
|
1913
|
+
const sourceDir = getSkillsSourceDir();
|
|
1914
|
+
const targetDir = getTargetDir(framework);
|
|
1915
|
+
fs2.mkdirSync(targetDir, { recursive: true });
|
|
1916
|
+
for (const name of skillNames) {
|
|
1917
|
+
const source = path3.join(sourceDir, name);
|
|
1918
|
+
const target = path3.join(targetDir, name);
|
|
1919
|
+
if (fs2.existsSync(target) || fs2.lstatSync(target).isSymbolicLink()) {
|
|
1920
|
+
fs2.rmSync(target, { recursive: true, force: true });
|
|
1921
|
+
}
|
|
1922
|
+
if (copy) {
|
|
1923
|
+
fs2.cpSync(source, target, { recursive: true });
|
|
1924
|
+
console.log(`copied ${name} -> ${target}`);
|
|
1925
|
+
} else {
|
|
1926
|
+
fs2.symlinkSync(source, target);
|
|
1927
|
+
console.log(`linked ${name} -> ${target}`);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1969
1931
|
function create() {
|
|
1970
1932
|
const program2 = new Command;
|
|
1971
|
-
program2.name("
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
console.error(`
|
|
1933
|
+
program2.version(version).name("install-skills").description("Install AI agent skills for a coding framework").argument("<framework>", `framework to install for (${frameworks.join(", ")})`).option("--copy", "copy files instead of creating symlinks").option("--force", "overwrite existing skill directories").action(async (framework, options) => {
|
|
1934
|
+
if (!frameworks.includes(framework)) {
|
|
1935
|
+
console.error(`Unknown framework: ${framework}`);
|
|
1936
|
+
console.error(`Supported frameworks: ${frameworks.join(", ")}`);
|
|
1975
1937
|
process.exit(1);
|
|
1976
1938
|
}
|
|
1977
|
-
if (options.
|
|
1978
|
-
|
|
1939
|
+
if (options.force) {
|
|
1940
|
+
forceInstallSkills(framework, !!options.copy);
|
|
1979
1941
|
} else {
|
|
1980
|
-
|
|
1981
|
-
const { id, name, path_with_namespace, ssh_url_to_repo } = p;
|
|
1982
|
-
return { id, name, path_with_namespace, ssh_url_to_repo };
|
|
1983
|
-
});
|
|
1984
|
-
console.log(filtered);
|
|
1942
|
+
installSkills(framework, !!options.copy);
|
|
1985
1943
|
}
|
|
1986
1944
|
});
|
|
1987
1945
|
return program2;
|
|
1988
1946
|
}
|
|
1989
|
-
var
|
|
1990
|
-
if (isMain("
|
|
1947
|
+
var gitj_install_skills_default = create;
|
|
1948
|
+
if (isMain("gitj-install-skills")) {
|
|
1991
1949
|
await create().parseAsync(Bun.argv);
|
|
1992
1950
|
}
|
|
1993
1951
|
export {
|
|
1994
|
-
|
|
1952
|
+
gitj_install_skills_default as default,
|
|
1995
1953
|
create
|
|
1996
1954
|
};
|