@brainervirus/workit-opencode 2.1.2 → 2.1.4
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/dist/plugin.js +37 -115
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -10401,7 +10401,6 @@ var LOCALE_RE = /^[a-z]{2,3}(-(?:[A-Z]{2}|[0-9]{3}))?$/;
|
|
|
10401
10401
|
var DEFAULTS = {
|
|
10402
10402
|
locale: "en",
|
|
10403
10403
|
localeOptions: ["en", "es-CL", "es-MX", "es-AR", "pt-BR"],
|
|
10404
|
-
timezone: "America/Santiago",
|
|
10405
10404
|
branchPolicy: {
|
|
10406
10405
|
preset: "gitflow",
|
|
10407
10406
|
allowed: [...PRESETS.gitflow.allowed],
|
|
@@ -10439,7 +10438,6 @@ var parseConfigResult = (raw, file) => {
|
|
|
10439
10438
|
config: {
|
|
10440
10439
|
locale,
|
|
10441
10440
|
localeOptions: Array.isArray(input.localeOptions) ? input.localeOptions : DEFAULTS.localeOptions,
|
|
10442
|
-
timezone: input.timezone ?? DEFAULTS.timezone,
|
|
10443
10441
|
branchPolicy: mergePreset(preset, {
|
|
10444
10442
|
allowed: Array.isArray(input.branchPolicy?.allowed) ? input.branchPolicy.allowed : undefined,
|
|
10445
10443
|
protectedNames: Array.isArray(input.branchPolicy?.protected) ? input.branchPolicy.protected : undefined
|
|
@@ -10464,7 +10462,6 @@ var readConfig = () => {
|
|
|
10464
10462
|
var mergeConfigValues = (input, current) => ({
|
|
10465
10463
|
locale: input.locale ?? current.locale,
|
|
10466
10464
|
localeOptions: input.localeOptions ?? current.localeOptions,
|
|
10467
|
-
timezone: input.timezone ?? current.timezone,
|
|
10468
10465
|
branchPolicy: mergePreset(input.preset ?? current.branchPolicy.preset, input, current),
|
|
10469
10466
|
commitPolicy: input.commitPolicy ?? current.commitPolicy
|
|
10470
10467
|
});
|
|
@@ -28297,8 +28294,6 @@ var INSTALLER_REQUIRED = new Set([
|
|
|
28297
28294
|
var YT_OVERRIDES = [
|
|
28298
28295
|
{ envKey: "WORKFLOW_YT_BASE_URL", affects: "youtrack.json baseUrl" },
|
|
28299
28296
|
{ envKey: "WORKFLOW_YT_TOKEN_FILE", affects: "youtrack.json tokenFile" },
|
|
28300
|
-
{ envKey: "WORKFLOW_YT_TIMEZONE", affects: "youtrack.json timezone" },
|
|
28301
|
-
{ envKey: "WORKFLOW_YT_MENTION", affects: "youtrack.json defaultMention" },
|
|
28302
28297
|
{ envKey: "WORKFLOW_YT_MEETING_ISSUE", affects: "youtrack.json meetingIssue" },
|
|
28303
28298
|
{ envKey: "WORKFLOW_YT_WEB_MEETING_ISSUE", affects: "youtrack.json web meeting issue" }
|
|
28304
28299
|
];
|
|
@@ -28459,56 +28454,19 @@ var readYouTrackContextConfig = () => {
|
|
|
28459
28454
|
return { error: "YouTrack configuration is unavailable" };
|
|
28460
28455
|
return { data: readOnlyYouTrackConfig(parsed) };
|
|
28461
28456
|
};
|
|
28462
|
-
|
|
28463
|
-
|
|
28464
|
-
|
|
28465
|
-
|
|
28466
|
-
|
|
28467
|
-
|
|
28468
|
-
|
|
28469
|
-
|
|
28470
|
-
|
|
28471
|
-
|
|
28472
|
-
|
|
28473
|
-
return
|
|
28474
|
-
}
|
|
28475
|
-
function youTrackGreeting(configOverride) {
|
|
28476
|
-
const cfgPath = configOverride ?? youTrackConfigPath();
|
|
28477
|
-
let parsed;
|
|
28478
|
-
try {
|
|
28479
|
-
parsed = JSON.parse(fs8.readFileSync(cfgPath, "utf8"));
|
|
28480
|
-
} catch {
|
|
28481
|
-
return {
|
|
28482
|
-
stdout: "",
|
|
28483
|
-
exitCode: 1,
|
|
28484
|
-
stderr: fs8.existsSync(cfgPath) ? `${cfgPath} is not valid JSON` : `missing youtrack.json: ${cfgPath}`
|
|
28485
|
-
};
|
|
28486
|
-
}
|
|
28487
|
-
if (!isConfigObject(parsed)) {
|
|
28488
|
-
return { stdout: "", exitCode: 1, stderr: `${cfgPath} is not a JSON object` };
|
|
28489
|
-
}
|
|
28490
|
-
const config = parsed;
|
|
28491
|
-
try {
|
|
28492
|
-
const tz = String(config.timezone ?? "America/Santiago");
|
|
28493
|
-
const now = new Date;
|
|
28494
|
-
const { y, m, d, hour, minute } = tzParts(now, tz);
|
|
28495
|
-
const cutoff = String(config.greetingCutoff ?? "12:00").split(":");
|
|
28496
|
-
const cutoffHour = Number(cutoff[0]);
|
|
28497
|
-
const cutoffMinute = Number(cutoff[1] ?? 0);
|
|
28498
|
-
const greetings = config.greetings ?? {};
|
|
28499
|
-
const isMorning = Number(hour) < cutoffHour || Number(hour) === cutoffHour && Number(minute) < cutoffMinute;
|
|
28500
|
-
const greeting = isMorning ? greetings.morning ?? "buenos días" : greetings.afternoon ?? "buenas tardes";
|
|
28501
|
-
const mention = String(config.defaultMention ?? "Alejandra.Flores");
|
|
28502
|
-
return { stdout: `@${mention} Hola, ${greeting}.
|
|
28503
|
-
`, exitCode: 0, stderr: "" };
|
|
28504
|
-
} catch (err) {
|
|
28505
|
-
return {
|
|
28506
|
-
stdout: "",
|
|
28507
|
-
exitCode: 1,
|
|
28508
|
-
stderr: err instanceof Error ? err.message : "greeting failed"
|
|
28509
|
-
};
|
|
28510
|
-
}
|
|
28511
|
-
}
|
|
28457
|
+
var processTimezone = () => Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
28458
|
+
var effectiveWorkTimezone = (cfg) => {
|
|
28459
|
+
const configured = cfg?.timezone;
|
|
28460
|
+
return typeof configured === "string" && configured.trim() ? { timezone: configured.trim(), source: "youtrack.json" } : { timezone: processTimezone(), source: "process" };
|
|
28461
|
+
};
|
|
28462
|
+
var DEFAULT_MEETING_WORK_ITEM_TEXT = "Meetings";
|
|
28463
|
+
var meetingWorkItemText = (cfg, item) => {
|
|
28464
|
+
if (typeof item?.workItemText === "string" && item.workItemText)
|
|
28465
|
+
return item.workItemText;
|
|
28466
|
+
if (typeof cfg?.meetingWorkItemText === "string" && cfg.meetingWorkItemText)
|
|
28467
|
+
return cfg.meetingWorkItemText;
|
|
28468
|
+
return DEFAULT_MEETING_WORK_ITEM_TEXT;
|
|
28469
|
+
};
|
|
28512
28470
|
function youTrackParseDuration(text) {
|
|
28513
28471
|
const lower = String(text).toLowerCase().trim();
|
|
28514
28472
|
let total = 0;
|
|
@@ -28577,10 +28535,10 @@ function youTrackTokenCreateUrl() {
|
|
|
28577
28535
|
const name = String(defaults.name ?? tokenName);
|
|
28578
28536
|
const desc = String(defaults.description ?? "OpenCode workit — /wk-issue-update and /wk-meetings");
|
|
28579
28537
|
const scopes = Array.isArray(defaults.scopes) ? defaults.scopes : ["YouTrack"];
|
|
28580
|
-
const base = String(config.baseUrl ?? "
|
|
28538
|
+
const base = String(config.baseUrl ?? "").replace(/\/+$/, "");
|
|
28581
28539
|
const tokenFile = String(config.tokenFile ?? path19.join(path19.dirname(loaded.path), "youtrack.token"));
|
|
28582
28540
|
const tab = String(defaults.profileTab ?? "account-security");
|
|
28583
|
-
const createUrl = `${base}/users/me?${new URLSearchParams({ tab })}
|
|
28541
|
+
const createUrl = base ? `${base}/users/me?${new URLSearchParams({ tab })}` : null;
|
|
28584
28542
|
const docsUrl = "https://www.jetbrains.com/help/youtrack/cloud/manage-permanent-token.html";
|
|
28585
28543
|
return {
|
|
28586
28544
|
data: {
|
|
@@ -28591,6 +28549,7 @@ function youTrackTokenCreateUrl() {
|
|
|
28591
28549
|
createUrl,
|
|
28592
28550
|
docsUrl,
|
|
28593
28551
|
prefillSupported: false,
|
|
28552
|
+
...base ? {} : { error: `baseUrl missing in ${loaded.path} — set your YouTrack base URL first` },
|
|
28594
28553
|
steps: [
|
|
28595
28554
|
"Profile → Account Security → **New token** (or open createUrl)",
|
|
28596
28555
|
`Name: **${name}**`,
|
|
@@ -28620,7 +28579,6 @@ function parseIssueRef(input) {
|
|
|
28620
28579
|
}
|
|
28621
28580
|
var contextScripts = {
|
|
28622
28581
|
config: readYouTrackContextConfig,
|
|
28623
|
-
greeting: () => youTrackGreeting(youTrackReadOnlyConfigPath()),
|
|
28624
28582
|
parseDuration: (text) => youTrackParseDuration(text),
|
|
28625
28583
|
api: () => ({ error: "YouTrack context is read-only" })
|
|
28626
28584
|
};
|
|
@@ -28649,7 +28607,7 @@ function meetingOptionsFromConfig(cfg) {
|
|
|
28649
28607
|
key,
|
|
28650
28608
|
issue: item.issue,
|
|
28651
28609
|
label: item.label ?? item.issue,
|
|
28652
|
-
workItemText: item
|
|
28610
|
+
workItemText: meetingWorkItemText(cfg, item),
|
|
28653
28611
|
url: item.url ?? (base && item.issue ? `${base}/issue/${item.issue}` : null)
|
|
28654
28612
|
}));
|
|
28655
28613
|
}
|
|
@@ -28659,7 +28617,7 @@ function meetingOptionsFromConfig(cfg) {
|
|
|
28659
28617
|
key: "general",
|
|
28660
28618
|
issue,
|
|
28661
28619
|
label: "General meetings",
|
|
28662
|
-
workItemText:
|
|
28620
|
+
workItemText: meetingWorkItemText(cfg),
|
|
28663
28621
|
url: base && issue ? `${base}/issue/${issue}` : null
|
|
28664
28622
|
}
|
|
28665
28623
|
];
|
|
@@ -28681,17 +28639,9 @@ var readOnlyYouTrackConfig = (cfg) => {
|
|
|
28681
28639
|
const baseUrl = publicUrl(cfg.baseUrl);
|
|
28682
28640
|
if (baseUrl)
|
|
28683
28641
|
safe.baseUrl = baseUrl;
|
|
28684
|
-
for (const key of ["timezone", "
|
|
28642
|
+
for (const key of ["timezone", "meetingIssue", "meetingWorkItemText"])
|
|
28685
28643
|
if (typeof cfg[key] === "string")
|
|
28686
28644
|
safe[key] = cfg[key];
|
|
28687
|
-
if (cfg.greetings && typeof cfg.greetings === "object" && !Array.isArray(cfg.greetings)) {
|
|
28688
|
-
const greetings = {};
|
|
28689
|
-
for (const key of ["morning", "afternoon"])
|
|
28690
|
-
if (typeof cfg.greetings[key] === "string")
|
|
28691
|
-
greetings[key] = cfg.greetings[key];
|
|
28692
|
-
if (Object.keys(greetings).length)
|
|
28693
|
-
safe.greetings = greetings;
|
|
28694
|
-
}
|
|
28695
28645
|
if (cfg.meetingIssues && typeof cfg.meetingIssues === "object" && !Array.isArray(cfg.meetingIssues)) {
|
|
28696
28646
|
safe.meetingIssues = Object.fromEntries(Object.entries(cfg.meetingIssues).flatMap(([key, value]) => {
|
|
28697
28647
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
@@ -28721,16 +28671,12 @@ function context({
|
|
|
28721
28671
|
const cfg = scripts.config();
|
|
28722
28672
|
if (cfg.error)
|
|
28723
28673
|
return { error: cfg.error };
|
|
28724
|
-
const greeting = scripts.greeting();
|
|
28725
|
-
if (greeting.exitCode !== 0) {
|
|
28726
|
-
return { error: (greeting.stderr || greeting.stdout || "greeting failed").trim() };
|
|
28727
|
-
}
|
|
28728
28674
|
const safeConfig = readOnlyYouTrackConfig(cfg.data);
|
|
28729
28675
|
const meetingOptions = meetingOptionsFromConfig(safeConfig);
|
|
28730
28676
|
if (mode === "meetings" && !issue_id && !issue_url && !issue_ref) {
|
|
28731
28677
|
return {
|
|
28732
28678
|
config: safeConfig,
|
|
28733
|
-
|
|
28679
|
+
workTimezone: effectiveWorkTimezone(safeConfig),
|
|
28734
28680
|
mode: "meetings",
|
|
28735
28681
|
requiresMeetingChoice: true,
|
|
28736
28682
|
meetingOptions,
|
|
@@ -28759,7 +28705,7 @@ function context({
|
|
|
28759
28705
|
const selectedMeeting = meetingOptions.find((m) => m.issue === issue);
|
|
28760
28706
|
return {
|
|
28761
28707
|
config: safeConfig,
|
|
28762
|
-
|
|
28708
|
+
workTimezone: effectiveWorkTimezone(safeConfig),
|
|
28763
28709
|
issueId: issue,
|
|
28764
28710
|
issueUrl,
|
|
28765
28711
|
mode: mode ?? (selectedMeeting ? "meetings" : "task"),
|
|
@@ -28824,39 +28770,23 @@ var resolveInitProvider = (cwd) => {
|
|
|
28824
28770
|
} catch {}
|
|
28825
28771
|
return null;
|
|
28826
28772
|
};
|
|
28827
|
-
var youtrackJsonContent = (dir) =>
|
|
28828
|
-
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
|
|
28832
|
-
|
|
28833
|
-
|
|
28834
|
-
|
|
28835
|
-
|
|
28836
|
-
|
|
28837
|
-
|
|
28838
|
-
|
|
28839
|
-
|
|
28840
|
-
|
|
28841
|
-
},
|
|
28842
|
-
web: {
|
|
28843
|
-
issue: process.env.WORKFLOW_YT_WEB_MEETING_ISSUE ?? "NSXFT-21",
|
|
28844
|
-
label: "Web meetings",
|
|
28845
|
-
workItemText: "Reuniones web",
|
|
28846
|
-
url: "https://enghouseamg.youtrack.cloud/projects/NSXFT/issues/NSXFT-21"
|
|
28773
|
+
var youtrackJsonContent = (dir) => {
|
|
28774
|
+
const meetingIssue = process.env.WORKFLOW_YT_MEETING_ISSUE;
|
|
28775
|
+
return {
|
|
28776
|
+
baseUrl: process.env.WORKFLOW_YT_BASE_URL ?? "https://youtrack.example.com",
|
|
28777
|
+
tokenFile: process.env.WORKFLOW_YT_TOKEN_FILE ?? path20.join(dir, "youtrack.token"),
|
|
28778
|
+
...meetingIssue ? {
|
|
28779
|
+
meetingIssue,
|
|
28780
|
+
meetingIssues: { general: { issue: meetingIssue, label: "General meetings" } }
|
|
28781
|
+
} : {},
|
|
28782
|
+
tokenDefaults: {
|
|
28783
|
+
name: "workit",
|
|
28784
|
+
description: "OpenCode workit — /wk-issue-update and /wk-meetings",
|
|
28785
|
+
scopes: ["YouTrack"],
|
|
28786
|
+
profileTab: "account-security"
|
|
28847
28787
|
}
|
|
28848
|
-
}
|
|
28849
|
-
|
|
28850
|
-
attachmentsHeaderImages: "## Adjunto capturas",
|
|
28851
|
-
attachmentsHeaderFiles: "## Archivos adjuntos",
|
|
28852
|
-
attachmentsHeaderMixed: "## Adjuntos",
|
|
28853
|
-
tokenDefaults: {
|
|
28854
|
-
name: "workit",
|
|
28855
|
-
description: "OpenCode workit — /wk-issue-update and /wk-meetings",
|
|
28856
|
-
scopes: ["YouTrack"],
|
|
28857
|
-
profileTab: "account-security"
|
|
28858
|
-
}
|
|
28859
|
-
});
|
|
28788
|
+
};
|
|
28789
|
+
};
|
|
28860
28790
|
var vcsJsonContent = () => {
|
|
28861
28791
|
const provider = resolveInitProvider();
|
|
28862
28792
|
return {
|
|
@@ -28930,8 +28860,6 @@ function initApplyData(action, env = process.env) {
|
|
|
28930
28860
|
baseUrl: base,
|
|
28931
28861
|
meetingIssue: meeting,
|
|
28932
28862
|
meetingIssueUrl: base && meeting ? `${base}/issue/${meeting}` : null,
|
|
28933
|
-
defaultMention: cfg.defaultMention,
|
|
28934
|
-
timezone: cfg.timezone,
|
|
28935
28863
|
locale: cfg.locale,
|
|
28936
28864
|
tokenCreate,
|
|
28937
28865
|
timeLogging: {
|
|
@@ -29076,7 +29004,6 @@ var executeInitApply = (args, directory, runtime) => {
|
|
|
29076
29004
|
const next = mergeConfigValues({
|
|
29077
29005
|
locale: args.locale,
|
|
29078
29006
|
localeOptions: args.locale_options,
|
|
29079
|
-
timezone: args.timezone,
|
|
29080
29007
|
preset: args.branch_policy_preset,
|
|
29081
29008
|
allowed: args.branch_policy_allowed,
|
|
29082
29009
|
protectedNames: args.branch_policy_protected
|
|
@@ -29086,7 +29013,6 @@ var executeInitApply = (args, directory, runtime) => {
|
|
|
29086
29013
|
}
|
|
29087
29014
|
const env = Object.fromEntries(Object.entries({
|
|
29088
29015
|
WORKFLOW_YT_BASE_URL: args.base_url,
|
|
29089
|
-
WORKFLOW_YT_MENTION: args.default_mention,
|
|
29090
29016
|
WORKFLOW_YT_MEETING_ISSUE: args.meeting_issue,
|
|
29091
29017
|
WORKFLOW_VCS_PROVIDER: args.vcs_provider,
|
|
29092
29018
|
WORKFLOW_VCS_TARGET_BRANCH: args.vcs_target_branch,
|
|
@@ -29116,7 +29042,6 @@ function createRepoTools(runtime = initApplyRuntime) {
|
|
|
29116
29042
|
"branch_policy"
|
|
29117
29043
|
]),
|
|
29118
29044
|
base_url: tool.schema.string().optional(),
|
|
29119
|
-
default_mention: tool.schema.string().optional(),
|
|
29120
29045
|
meeting_issue: tool.schema.string().optional(),
|
|
29121
29046
|
vcs_provider: tool.schema.enum(["gitlab", "github"]).optional(),
|
|
29122
29047
|
vcs_target_branch: tool.schema.string().optional(),
|
|
@@ -29125,7 +29050,6 @@ function createRepoTools(runtime = initApplyRuntime) {
|
|
|
29125
29050
|
integration: tool.schema.enum(["pr", "merge"]).optional(),
|
|
29126
29051
|
locale: tool.schema.string().optional(),
|
|
29127
29052
|
locale_options: tool.schema.array(tool.schema.string()).optional(),
|
|
29128
|
-
timezone: tool.schema.string().optional(),
|
|
29129
29053
|
branch_policy_preset: tool.schema.enum(["gitflow", "github-flow", "trunk-based", "custom"]).optional(),
|
|
29130
29054
|
branch_policy_allowed: tool.schema.array(tool.schema.string()).optional(),
|
|
29131
29055
|
branch_policy_protected: tool.schema.array(tool.schema.string()).optional(),
|
|
@@ -30869,7 +30793,6 @@ var WORKIT_TOOL_CATALOG = [
|
|
|
30869
30793
|
]
|
|
30870
30794
|
},
|
|
30871
30795
|
base_url: { type: "string" },
|
|
30872
|
-
default_mention: { type: "string" },
|
|
30873
30796
|
meeting_issue: { type: "string" },
|
|
30874
30797
|
vcs_provider: { type: "string", enum: ["gitlab", "github"] },
|
|
30875
30798
|
vcs_target_branch: { type: "string" },
|
|
@@ -30878,7 +30801,6 @@ var WORKIT_TOOL_CATALOG = [
|
|
|
30878
30801
|
integration: { type: "string", enum: ["pr", "merge"] },
|
|
30879
30802
|
locale: { type: "string" },
|
|
30880
30803
|
locale_options: { type: "array", items: { type: "string" } },
|
|
30881
|
-
timezone: { type: "string" },
|
|
30882
30804
|
branch_policy_preset: {
|
|
30883
30805
|
type: "string",
|
|
30884
30806
|
enum: ["gitflow", "github-flow", "trunk-based", "custom"]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainervirus/workit-opencode",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit OpenCode plugin — native tools, adaptive policy, and fourteen method skills",
|
|
6
6
|
"keywords": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"typecheck": "tsc --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@brainervirus/workit-core": "^2.1.
|
|
42
|
+
"@brainervirus/workit-core": "^2.1.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@opencode-ai/plugin": "1.18.30",
|