@brainervirus/workit-cli 2.1.2 → 2.1.3
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/README.md +1 -1
- package/assets/templates/issue-update.md +1 -2
- package/dist/index.js +121 -249
- package/package.json +4 -4
- package/assets/templates/greeting.md +0 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ workit uninstall # remove host registrations (keeps ~/
|
|
|
34
34
|
workit # help
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
`workit init` guides you through: detected host selection, basic global config (locale,
|
|
37
|
+
`workit init` guides you through: detected host selection, basic global config (locale, branch policy), optional advanced commit policy, YouTrack, VCS, workspaces (scoped hosting/tracker/branch/commit rules, profiles and release tracks), and project hygiene files. The wizard is a TTY application — `workit init` requires an interactive terminal and prints guidance (exiting nonzero) when stdin is not a TTY.
|
|
38
38
|
|
|
39
39
|
Authenticate GitHub or GitLab with `gh auth login` or `glab auth login` before hosting actions; Workit does not need a second provider token file. `workit action` Git/hosting payloads accept `cwd` to target any checkout while task state stays in the session directory. Non-Git directories can host tasks for OS work; YouTrack keeps its own permanent token.
|
|
40
40
|
|
package/dist/index.js
CHANGED
|
@@ -42356,7 +42356,6 @@ var LOCALE_RE = /^[a-z]{2,3}(-(?:[A-Z]{2}|[0-9]{3}))?$/;
|
|
|
42356
42356
|
var DEFAULTS = {
|
|
42357
42357
|
locale: "en",
|
|
42358
42358
|
localeOptions: ["en", "es-CL", "es-MX", "es-AR", "pt-BR"],
|
|
42359
|
-
timezone: "America/Santiago",
|
|
42360
42359
|
branchPolicy: {
|
|
42361
42360
|
preset: "gitflow",
|
|
42362
42361
|
allowed: [...PRESETS.gitflow.allowed],
|
|
@@ -42394,7 +42393,6 @@ var parseConfigResult = (raw, file) => {
|
|
|
42394
42393
|
config: {
|
|
42395
42394
|
locale,
|
|
42396
42395
|
localeOptions: Array.isArray(input.localeOptions) ? input.localeOptions : DEFAULTS.localeOptions,
|
|
42397
|
-
timezone: input.timezone ?? DEFAULTS.timezone,
|
|
42398
42396
|
branchPolicy: mergePreset(preset, {
|
|
42399
42397
|
allowed: Array.isArray(input.branchPolicy?.allowed) ? input.branchPolicy.allowed : undefined,
|
|
42400
42398
|
protectedNames: Array.isArray(input.branchPolicy?.protected) ? input.branchPolicy.protected : undefined
|
|
@@ -51934,9 +51932,6 @@ function previewConversion(input) {
|
|
|
51934
51932
|
if (config.locale !== undefined) {
|
|
51935
51933
|
mappings.push({ key: "locale", from: config.locale, to: config.locale });
|
|
51936
51934
|
}
|
|
51937
|
-
if (config.timezone !== undefined) {
|
|
51938
|
-
mappings.push({ key: "timezone", from: config.timezone, to: config.timezone });
|
|
51939
|
-
}
|
|
51940
51935
|
if (config.branchPolicy !== undefined && isConfigObject(config.branchPolicy)) {
|
|
51941
51936
|
const bp = config.branchPolicy;
|
|
51942
51937
|
const preset = bp.preset ?? "gitflow";
|
|
@@ -51986,7 +51981,7 @@ function applyConversionConfig(configDir, preview, resolutions) {
|
|
|
51986
51981
|
const raw = readJsonObject(configFile) ?? {};
|
|
51987
51982
|
const next = { ...raw };
|
|
51988
51983
|
for (const mapping of preview.mappings) {
|
|
51989
|
-
if (mapping.key === "locale"
|
|
51984
|
+
if (mapping.key === "locale") {
|
|
51990
51985
|
next[mapping.key] = mapping.to;
|
|
51991
51986
|
}
|
|
51992
51987
|
if (mapping.key === "branchPolicy" && !resolutions["branchPolicy.allowed"]) {
|
|
@@ -54995,8 +54990,6 @@ function parseList(raw) {
|
|
|
54995
54990
|
var YT_OVERRIDES = [
|
|
54996
54991
|
{ envKey: "WORKFLOW_YT_BASE_URL", affects: "youtrack.json baseUrl" },
|
|
54997
54992
|
{ envKey: "WORKFLOW_YT_TOKEN_FILE", affects: "youtrack.json tokenFile" },
|
|
54998
|
-
{ envKey: "WORKFLOW_YT_TIMEZONE", affects: "youtrack.json timezone" },
|
|
54999
|
-
{ envKey: "WORKFLOW_YT_MENTION", affects: "youtrack.json defaultMention" },
|
|
55000
54993
|
{ envKey: "WORKFLOW_YT_MEETING_ISSUE", affects: "youtrack.json meetingIssue" },
|
|
55001
54994
|
{ envKey: "WORKFLOW_YT_WEB_MEETING_ISSUE", affects: "youtrack.json web meeting issue" }
|
|
55002
54995
|
];
|
|
@@ -55027,7 +55020,6 @@ function youtrackDraft(values, tokenPath) {
|
|
|
55027
55020
|
return {
|
|
55028
55021
|
baseUrl: values.baseUrl.replace(/\/+$/, ""),
|
|
55029
55022
|
tokenFile: tokenPath,
|
|
55030
|
-
timezone: values.timezone,
|
|
55031
55023
|
locale: values.locale,
|
|
55032
55024
|
tokenDefaults: {
|
|
55033
55025
|
name: "workit",
|
|
@@ -55091,7 +55083,6 @@ function buildSetupPreview(values, opts = {}) {
|
|
|
55091
55083
|
value: {
|
|
55092
55084
|
locale: values.locale,
|
|
55093
55085
|
localeOptions: current.localeOptions,
|
|
55094
|
-
timezone: values.timezone,
|
|
55095
55086
|
...values.commitPolicy === undefined ? {} : { commitPolicy: values.commitPolicy },
|
|
55096
55087
|
branchPolicy: mergePreset(values.branchPreset, {
|
|
55097
55088
|
allowed: values.branchPreset === "custom" ? parseList(values.branchAllowed) : undefined,
|
|
@@ -56052,16 +56043,6 @@ function validateLocale(locale) {
|
|
|
56052
56043
|
}
|
|
56053
56044
|
return null;
|
|
56054
56045
|
}
|
|
56055
|
-
var KNOWN_TIMEZONES = typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone") : null;
|
|
56056
|
-
function validateTimezone(timezone) {
|
|
56057
|
-
const tz = timezone.trim();
|
|
56058
|
-
if (!tz)
|
|
56059
|
-
return "timezone is required";
|
|
56060
|
-
if (KNOWN_TIMEZONES && !KNOWN_TIMEZONES.includes(tz)) {
|
|
56061
|
-
return `unknown timezone "${tz}" — check the IANA name (e.g. America/Santiago)`;
|
|
56062
|
-
}
|
|
56063
|
-
return null;
|
|
56064
|
-
}
|
|
56065
56046
|
function validateBaseUrl(url) {
|
|
56066
56047
|
let parsed;
|
|
56067
56048
|
try {
|
|
@@ -56290,10 +56271,8 @@ import path15 from "node:path";
|
|
|
56290
56271
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
56291
56272
|
var NEXT = {
|
|
56292
56273
|
platforms: "locale",
|
|
56293
|
-
locale: "
|
|
56294
|
-
localeOther: "
|
|
56295
|
-
timezone: "branchPreset",
|
|
56296
|
-
timezoneOther: "branchPreset",
|
|
56274
|
+
locale: "branchPreset",
|
|
56275
|
+
localeOther: "branchPreset",
|
|
56297
56276
|
branchPreset: "branchAllowed",
|
|
56298
56277
|
branchAllowed: "branchProtected",
|
|
56299
56278
|
branchProtected: "issueTracker",
|
|
@@ -56319,9 +56298,7 @@ var PREV = {
|
|
|
56319
56298
|
platforms: null,
|
|
56320
56299
|
locale: "platforms",
|
|
56321
56300
|
localeOther: "locale",
|
|
56322
|
-
|
|
56323
|
-
timezoneOther: "timezone",
|
|
56324
|
-
branchPreset: "timezone",
|
|
56301
|
+
branchPreset: "locale",
|
|
56325
56302
|
branchAllowed: "branchPreset",
|
|
56326
56303
|
branchProtected: "branchAllowed",
|
|
56327
56304
|
issueTracker: "branchProtected",
|
|
@@ -56378,23 +56355,26 @@ function validateScreen(draft) {
|
|
|
56378
56355
|
const { screen, values } = draft;
|
|
56379
56356
|
switch (screen) {
|
|
56380
56357
|
case "platforms":
|
|
56381
|
-
return values.platforms.length > 0 ? null : {
|
|
56358
|
+
return values.platforms.length > 0 ? null : {
|
|
56359
|
+
field: "platforms",
|
|
56360
|
+
message: "Select at least one platform to continue."
|
|
56361
|
+
};
|
|
56382
56362
|
case "locale":
|
|
56383
56363
|
return values.locale.trim() ? null : { field: "locale", message: "locale is required" };
|
|
56384
|
-
case "timezone":
|
|
56385
|
-
return values.timezone.trim() ? null : { field: "timezone", message: "timezone is required" };
|
|
56386
56364
|
case "localeOther": {
|
|
56387
56365
|
const error = validateLocale(values.locale);
|
|
56388
56366
|
return error ? { field: "locale", message: error } : null;
|
|
56389
56367
|
}
|
|
56390
|
-
case "timezoneOther": {
|
|
56391
|
-
const error = validateTimezone(values.timezone);
|
|
56392
|
-
return error ? { field: "timezone", message: error } : null;
|
|
56393
|
-
}
|
|
56394
56368
|
case "branchAllowed":
|
|
56395
|
-
return parseList(values.branchAllowed).length > 0 ? null : {
|
|
56369
|
+
return parseList(values.branchAllowed).length > 0 ? null : {
|
|
56370
|
+
field: "branchAllowed",
|
|
56371
|
+
message: "at least one allowed branch pattern is required"
|
|
56372
|
+
};
|
|
56396
56373
|
case "branchProtected":
|
|
56397
|
-
return parseList(values.branchProtected).length > 0 ? null : {
|
|
56374
|
+
return parseList(values.branchProtected).length > 0 ? null : {
|
|
56375
|
+
field: "branchProtected",
|
|
56376
|
+
message: "at least one protected branch name is required"
|
|
56377
|
+
};
|
|
56398
56378
|
case "youtrack": {
|
|
56399
56379
|
if (values.baseUrl.trim() === "")
|
|
56400
56380
|
return null;
|
|
@@ -56410,7 +56390,10 @@ function validateScreen(draft) {
|
|
|
56410
56390
|
case "workspaceGlob": {
|
|
56411
56391
|
const glob = (draft.workspaceDraft?.glob ?? "").trim();
|
|
56412
56392
|
if (!glob)
|
|
56413
|
-
return {
|
|
56393
|
+
return {
|
|
56394
|
+
field: "workspaceGlob",
|
|
56395
|
+
message: "workspace pattern is required"
|
|
56396
|
+
};
|
|
56414
56397
|
const v = validateWorkspaceGlob(glob);
|
|
56415
56398
|
return v.ok ? null : { field: "workspaceGlob", message: v.error };
|
|
56416
56399
|
}
|
|
@@ -56422,7 +56405,7 @@ var decodeBranchPreset = (value, fallback) => value === "gitflow" || value === "
|
|
|
56422
56405
|
var decodeVcsProvider = (value, fallback) => value === "gitlab" || value === "github" || value === "skip" ? value : fallback;
|
|
56423
56406
|
var decodeIssueTracker = (value, fallback) => value === "youtrack" || value === "github" || value === "gitlab" || value === "none" ? value : fallback;
|
|
56424
56407
|
function setTextValue(draft, field, value) {
|
|
56425
|
-
const message = field === "locale" ? validateLocale(value) : field === "
|
|
56408
|
+
const message = field === "locale" ? validateLocale(value) : field === "branchAllowed" ? parseList(value).length > 0 ? null : "at least one allowed branch pattern is required" : field === "branchProtected" ? parseList(value).length > 0 ? null : "at least one protected branch name is required" : field === "basePath" ? basePathMessage(value) : value.trim() === "" ? null : validateBaseUrl(value);
|
|
56426
56409
|
if (draft.values[field] === value && (draft.errors[field] ?? undefined) === (message ?? undefined)) {
|
|
56427
56410
|
return draft;
|
|
56428
56411
|
}
|
|
@@ -56440,7 +56423,6 @@ function createInitialDraft(config = readConfig(), opts = {}) {
|
|
|
56440
56423
|
values: {
|
|
56441
56424
|
platforms: opts.platforms ?? [],
|
|
56442
56425
|
locale: config.locale,
|
|
56443
|
-
timezone: config.timezone,
|
|
56444
56426
|
branchPreset: config.branchPolicy.preset,
|
|
56445
56427
|
branchAllowed: policy.allowed.join(", "),
|
|
56446
56428
|
branchProtected: policy.protected.join(", "),
|
|
@@ -56465,7 +56447,10 @@ function reducer3(draft, action) {
|
|
|
56465
56447
|
case "platforms":
|
|
56466
56448
|
if (isDeepStrictEqual3(action.value, draft.values.platforms))
|
|
56467
56449
|
return draft;
|
|
56468
|
-
return {
|
|
56450
|
+
return {
|
|
56451
|
+
...draft,
|
|
56452
|
+
values: { ...draft.values, platforms: action.value }
|
|
56453
|
+
};
|
|
56469
56454
|
case "branchPreset": {
|
|
56470
56455
|
const next = decodeBranchPreset(action.value, draft.values.branchPreset);
|
|
56471
56456
|
if (next === draft.values.branchPreset)
|
|
@@ -56499,9 +56484,15 @@ function reducer3(draft, action) {
|
|
|
56499
56484
|
case "applyProject":
|
|
56500
56485
|
if (action.value === draft.values.applyProject)
|
|
56501
56486
|
return draft;
|
|
56502
|
-
return {
|
|
56487
|
+
return {
|
|
56488
|
+
...draft,
|
|
56489
|
+
values: { ...draft.values, applyProject: action.value }
|
|
56490
|
+
};
|
|
56503
56491
|
case "branchPolicyDetected":
|
|
56504
|
-
return {
|
|
56492
|
+
return {
|
|
56493
|
+
...draft,
|
|
56494
|
+
values: { ...draft.values, branchPolicyDetected: action.value }
|
|
56495
|
+
};
|
|
56505
56496
|
case "branchPolicy":
|
|
56506
56497
|
if (draft.values.branchPolicy)
|
|
56507
56498
|
return draft;
|
|
@@ -56554,15 +56545,16 @@ function reducer3(draft, action) {
|
|
|
56554
56545
|
case "pickOther":
|
|
56555
56546
|
if (draft.screen === "locale")
|
|
56556
56547
|
return { ...draft, screen: "localeOther" };
|
|
56557
|
-
if (draft.screen === "timezone")
|
|
56558
|
-
return { ...draft, screen: "timezoneOther" };
|
|
56559
56548
|
return draft;
|
|
56560
56549
|
case "branchPolicyEditDevelop":
|
|
56561
56550
|
return { ...draft, screen: "branchPolicyDevelop" };
|
|
56562
56551
|
case "next": {
|
|
56563
56552
|
const invalid = validateScreen(draft);
|
|
56564
56553
|
if (invalid)
|
|
56565
|
-
return {
|
|
56554
|
+
return {
|
|
56555
|
+
...draft,
|
|
56556
|
+
errors: { ...draft.errors, [invalid.field]: invalid.message }
|
|
56557
|
+
};
|
|
56566
56558
|
return {
|
|
56567
56559
|
...draft,
|
|
56568
56560
|
screen: nextScreen(draft.screen, draft.values.branchPreset, draft.values.issueTracker, resolveBasePath(draft.values))
|
|
@@ -56662,7 +56654,11 @@ function reducer3(draft, action) {
|
|
|
56662
56654
|
};
|
|
56663
56655
|
}
|
|
56664
56656
|
case "workspaceAdvancedSelect":
|
|
56665
|
-
return {
|
|
56657
|
+
return {
|
|
56658
|
+
...draft,
|
|
56659
|
+
screen: "workspaceAdvancedValue",
|
|
56660
|
+
workspaceEditorField: action.field
|
|
56661
|
+
};
|
|
56666
56662
|
case "workspaceAdvancedSet": {
|
|
56667
56663
|
if (!draft.workspaceDraft)
|
|
56668
56664
|
return draft;
|
|
@@ -56706,7 +56702,10 @@ function reducer3(draft, action) {
|
|
|
56706
56702
|
...draft,
|
|
56707
56703
|
values: {
|
|
56708
56704
|
...draft.values,
|
|
56709
|
-
commitPolicy: {
|
|
56705
|
+
commitPolicy: {
|
|
56706
|
+
...draft.values.commitPolicy,
|
|
56707
|
+
pattern: action.value || undefined
|
|
56708
|
+
}
|
|
56710
56709
|
}
|
|
56711
56710
|
};
|
|
56712
56711
|
case "globalCommitPatternDone":
|
|
@@ -56719,7 +56718,10 @@ function reducer3(draft, action) {
|
|
|
56719
56718
|
...draft.workspaceDraft.profiles,
|
|
56720
56719
|
[name]: { commitPolicy: { preset: "conventional" } }
|
|
56721
56720
|
};
|
|
56722
|
-
return {
|
|
56721
|
+
return {
|
|
56722
|
+
...draft,
|
|
56723
|
+
workspaceDraft: { ...draft.workspaceDraft, profiles }
|
|
56724
|
+
};
|
|
56723
56725
|
}
|
|
56724
56726
|
case "workspaceProfileDelete": {
|
|
56725
56727
|
if (!draft.workspaceDraft?.profiles?.[action.name])
|
|
@@ -56738,7 +56740,13 @@ function reducer3(draft, action) {
|
|
|
56738
56740
|
case "workspaceProfileDefault": {
|
|
56739
56741
|
if (!draft.workspaceDraft?.profiles?.[action.name])
|
|
56740
56742
|
return draft;
|
|
56741
|
-
return {
|
|
56743
|
+
return {
|
|
56744
|
+
...draft,
|
|
56745
|
+
workspaceDraft: {
|
|
56746
|
+
...draft.workspaceDraft,
|
|
56747
|
+
defaultProfile: action.name
|
|
56748
|
+
}
|
|
56749
|
+
};
|
|
56742
56750
|
}
|
|
56743
56751
|
case "workspaceProfileSet": {
|
|
56744
56752
|
const profile = draft.workspaceDraft?.profiles?.[action.name];
|
|
@@ -56766,7 +56774,10 @@ function reducer3(draft, action) {
|
|
|
56766
56774
|
...draft,
|
|
56767
56775
|
workspaceDraft: {
|
|
56768
56776
|
...draft.workspaceDraft,
|
|
56769
|
-
releaseTracks: {
|
|
56777
|
+
releaseTracks: {
|
|
56778
|
+
...draft.workspaceDraft.releaseTracks,
|
|
56779
|
+
[name]: createReleaseTrack()
|
|
56780
|
+
}
|
|
56770
56781
|
}
|
|
56771
56782
|
};
|
|
56772
56783
|
}
|
|
@@ -56775,7 +56786,10 @@ function reducer3(draft, action) {
|
|
|
56775
56786
|
return draft;
|
|
56776
56787
|
const releaseTracks = { ...draft.workspaceDraft.releaseTracks };
|
|
56777
56788
|
delete releaseTracks[action.name];
|
|
56778
|
-
return {
|
|
56789
|
+
return {
|
|
56790
|
+
...draft,
|
|
56791
|
+
workspaceDraft: { ...draft.workspaceDraft, releaseTracks }
|
|
56792
|
+
};
|
|
56779
56793
|
}
|
|
56780
56794
|
case "workspaceTrackSet": {
|
|
56781
56795
|
const track = draft.workspaceDraft?.releaseTracks?.[action.name];
|
|
@@ -57273,7 +57287,6 @@ var BRANCH_PRESET_DESCRIPTIONS = {
|
|
|
57273
57287
|
var SCREEN_PLACEHOLDERS = {
|
|
57274
57288
|
youtrack: "e.g. https://example.youtrack.cloud",
|
|
57275
57289
|
localeOther: "e.g. en-US or es-CL",
|
|
57276
|
-
timezoneOther: "e.g. America/Santiago",
|
|
57277
57290
|
branchAllowed: "e.g. feature/*, bugfix/*",
|
|
57278
57291
|
branchProtected: "e.g. main, develop",
|
|
57279
57292
|
workspaceName: "e.g. work",
|
|
@@ -57388,38 +57401,8 @@ var commitPresetOptions = [
|
|
|
57388
57401
|
{ label: "Custom pattern", value: "custom" },
|
|
57389
57402
|
{ label: "Auto-detect", value: "auto" }
|
|
57390
57403
|
];
|
|
57391
|
-
var TIMEZONE_FALLBACK = [
|
|
57392
|
-
"UTC",
|
|
57393
|
-
"America/New_York",
|
|
57394
|
-
"America/Santiago",
|
|
57395
|
-
"America/Bogota",
|
|
57396
|
-
"America/Mexico_City",
|
|
57397
|
-
"America/Sao_Paulo",
|
|
57398
|
-
"America/Argentina/Buenos_Aires",
|
|
57399
|
-
"Europe/London",
|
|
57400
|
-
"Europe/Madrid",
|
|
57401
|
-
"Europe/Berlin",
|
|
57402
|
-
"Asia/Tokyo",
|
|
57403
|
-
"Asia/Shanghai",
|
|
57404
|
-
"Asia/Kolkata",
|
|
57405
|
-
"Australia/Sydney"
|
|
57406
|
-
];
|
|
57407
|
-
var TIMEZONES = typeof Intl.supportedValuesOf === "function" ? Intl.supportedValuesOf("timeZone") : TIMEZONE_FALLBACK;
|
|
57408
|
-
var DETECTED_TIMEZONE = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
57409
|
-
function timezonePickerOptions() {
|
|
57410
|
-
return TIMEZONE_PICKER_OPTIONS;
|
|
57411
|
-
}
|
|
57412
|
-
var TIMEZONE_PICKER_OPTIONS = [
|
|
57413
|
-
{ label: DETECTED_TIMEZONE, value: DETECTED_TIMEZONE },
|
|
57414
|
-
...TIMEZONES.filter((timezone) => timezone !== DETECTED_TIMEZONE).map((timezone) => ({
|
|
57415
|
-
label: timezone,
|
|
57416
|
-
value: timezone
|
|
57417
|
-
})),
|
|
57418
|
-
{ label: "Other…", value: "other" }
|
|
57419
|
-
];
|
|
57420
57404
|
var TEXT_SCREENS = new Set([
|
|
57421
57405
|
"localeOther",
|
|
57422
|
-
"timezoneOther",
|
|
57423
57406
|
"branchAllowed",
|
|
57424
57407
|
"branchProtected",
|
|
57425
57408
|
"youtrack",
|
|
@@ -57430,7 +57413,7 @@ var TEXT_SCREENS = new Set([
|
|
|
57430
57413
|
"globalCommitPattern",
|
|
57431
57414
|
"branchPolicyDevelop"
|
|
57432
57415
|
]);
|
|
57433
|
-
var SEARCH_SCREENS = new Set(["locale"
|
|
57416
|
+
var SEARCH_SCREENS = new Set(["locale"]);
|
|
57434
57417
|
function workspacePreviewTargets(cwd) {
|
|
57435
57418
|
const norm = cwd.replace(/[\\/]+$/, "");
|
|
57436
57419
|
const idx = norm.lastIndexOf("/");
|
|
@@ -58312,80 +58295,6 @@ function Screen({
|
|
|
58312
58295
|
}, undefined, false, undefined, this)
|
|
58313
58296
|
]
|
|
58314
58297
|
}, undefined, true, undefined, this);
|
|
58315
|
-
case "timezone":
|
|
58316
|
-
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
58317
|
-
flexDirection: "column",
|
|
58318
|
-
gap: 1,
|
|
58319
|
-
children: [
|
|
58320
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58321
|
-
bold: true,
|
|
58322
|
-
children: "Step 2 — Global config · Timezone"
|
|
58323
|
-
}, undefined, false, undefined, this),
|
|
58324
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58325
|
-
dimColor: true,
|
|
58326
|
-
children: "Timezone (IANA name):"
|
|
58327
|
-
}, undefined, false, undefined, this),
|
|
58328
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58329
|
-
children: [
|
|
58330
|
-
"Current: ",
|
|
58331
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58332
|
-
color: "green",
|
|
58333
|
-
children: draft.values.timezone
|
|
58334
|
-
}, undefined, false, undefined, this)
|
|
58335
|
-
]
|
|
58336
|
-
}, undefined, true, undefined, this),
|
|
58337
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(SearchSelect, {
|
|
58338
|
-
options: timezonePickerOptions(),
|
|
58339
|
-
value: draft.values.timezone || DETECTED_TIMEZONE,
|
|
58340
|
-
placeholder: "Type to search timezones…",
|
|
58341
|
-
onQueryChange: onSearchQueryChange,
|
|
58342
|
-
onSelect: (value) => {
|
|
58343
|
-
if (value === "other")
|
|
58344
|
-
dispatch({ type: "pickOther" });
|
|
58345
|
-
else {
|
|
58346
|
-
dispatch({ type: "set", field: "timezone", value });
|
|
58347
|
-
dispatch({ type: "next" });
|
|
58348
|
-
}
|
|
58349
|
-
}
|
|
58350
|
-
}, undefined, false, undefined, this),
|
|
58351
|
-
draft.errors.timezone && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58352
|
-
color: "red",
|
|
58353
|
-
children: draft.errors.timezone
|
|
58354
|
-
}, undefined, false, undefined, this),
|
|
58355
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58356
|
-
dimColor: true,
|
|
58357
|
-
children: "Type to filter · Enter to continue · b Back · Esc Cancel"
|
|
58358
|
-
}, undefined, false, undefined, this)
|
|
58359
|
-
]
|
|
58360
|
-
}, undefined, true, undefined, this);
|
|
58361
|
-
case "timezoneOther":
|
|
58362
|
-
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
58363
|
-
flexDirection: "column",
|
|
58364
|
-
gap: 1,
|
|
58365
|
-
children: [
|
|
58366
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58367
|
-
bold: true,
|
|
58368
|
-
children: "Step 2 — Global config · Timezone (custom)"
|
|
58369
|
-
}, undefined, false, undefined, this),
|
|
58370
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58371
|
-
dimColor: true,
|
|
58372
|
-
children: "Type an IANA timezone (e.g. America/Santiago):"
|
|
58373
|
-
}, undefined, false, undefined, this),
|
|
58374
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(TextInput, {
|
|
58375
|
-
placeholder: SCREEN_PLACEHOLDERS.timezoneOther,
|
|
58376
|
-
onChange: (value) => dispatch({ type: "set", field: "timezone", value }),
|
|
58377
|
-
onSubmit: () => dispatch({ type: "next" })
|
|
58378
|
-
}, undefined, false, undefined, this),
|
|
58379
|
-
draft.errors.timezone && /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58380
|
-
color: "red",
|
|
58381
|
-
children: draft.errors.timezone
|
|
58382
|
-
}, undefined, false, undefined, this),
|
|
58383
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
58384
|
-
dimColor: true,
|
|
58385
|
-
children: "Enter to continue · Esc Back"
|
|
58386
|
-
}, undefined, false, undefined, this)
|
|
58387
|
-
]
|
|
58388
|
-
}, undefined, true, undefined, this);
|
|
58389
58298
|
case "branchPreset": {
|
|
58390
58299
|
const policy = effectivePolicy(draft.values);
|
|
58391
58300
|
return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Box_default, {
|
|
@@ -59025,15 +58934,6 @@ function Screen({
|
|
|
59025
58934
|
}, undefined, false, undefined, this)
|
|
59026
58935
|
]
|
|
59027
58936
|
}, undefined, true, undefined, this),
|
|
59028
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
59029
|
-
children: [
|
|
59030
|
-
"Timezone: ",
|
|
59031
|
-
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
59032
|
-
color: "green",
|
|
59033
|
-
children: draft.values.timezone
|
|
59034
|
-
}, undefined, false, undefined, this)
|
|
59035
|
-
]
|
|
59036
|
-
}, undefined, true, undefined, this),
|
|
59037
58937
|
/* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Text, {
|
|
59038
58938
|
children: [
|
|
59039
58939
|
"Branch policy: ",
|
|
@@ -67988,51 +67888,29 @@ function tzParts(date, tz) {
|
|
|
67988
67888
|
timeZone: tz,
|
|
67989
67889
|
year: "numeric",
|
|
67990
67890
|
month: "2-digit",
|
|
67991
|
-
day: "2-digit"
|
|
67992
|
-
hour: "2-digit",
|
|
67993
|
-
minute: "2-digit",
|
|
67994
|
-
hourCycle: "h23"
|
|
67891
|
+
day: "2-digit"
|
|
67995
67892
|
}).formatToParts(date);
|
|
67996
67893
|
const map = Object.fromEntries(parts.map((p) => [p.type, p.value]));
|
|
67997
|
-
return { y: map.year, m: map.month, d: map.day
|
|
67998
|
-
}
|
|
67999
|
-
|
|
68000
|
-
|
|
68001
|
-
|
|
68002
|
-
|
|
68003
|
-
|
|
68004
|
-
|
|
68005
|
-
|
|
68006
|
-
|
|
68007
|
-
|
|
68008
|
-
|
|
68009
|
-
|
|
68010
|
-
|
|
68011
|
-
|
|
68012
|
-
|
|
68013
|
-
|
|
68014
|
-
const
|
|
68015
|
-
|
|
68016
|
-
|
|
68017
|
-
const now = new Date;
|
|
68018
|
-
const { y, m, d, hour, minute } = tzParts(now, tz);
|
|
68019
|
-
const cutoff = String(config.greetingCutoff ?? "12:00").split(":");
|
|
68020
|
-
const cutoffHour = Number(cutoff[0]);
|
|
68021
|
-
const cutoffMinute = Number(cutoff[1] ?? 0);
|
|
68022
|
-
const greetings = config.greetings ?? {};
|
|
68023
|
-
const isMorning = Number(hour) < cutoffHour || Number(hour) === cutoffHour && Number(minute) < cutoffMinute;
|
|
68024
|
-
const greeting = isMorning ? greetings.morning ?? "buenos días" : greetings.afternoon ?? "buenas tardes";
|
|
68025
|
-
const mention = String(config.defaultMention ?? "Alejandra.Flores");
|
|
68026
|
-
return { stdout: `@${mention} Hola, ${greeting}.
|
|
68027
|
-
`, exitCode: 0, stderr: "" };
|
|
68028
|
-
} catch (err) {
|
|
68029
|
-
return {
|
|
68030
|
-
stdout: "",
|
|
68031
|
-
exitCode: 1,
|
|
68032
|
-
stderr: err instanceof Error ? err.message : "greeting failed"
|
|
68033
|
-
};
|
|
68034
|
-
}
|
|
68035
|
-
}
|
|
67894
|
+
return { y: map.year, m: map.month, d: map.day };
|
|
67895
|
+
}
|
|
67896
|
+
var processTimezone = () => Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
|
|
67897
|
+
var effectiveWorkTimezone = (cfg) => {
|
|
67898
|
+
const configured = cfg?.timezone;
|
|
67899
|
+
return typeof configured === "string" && configured.trim() ? { timezone: configured.trim(), source: "youtrack.json" } : { timezone: processTimezone(), source: "process" };
|
|
67900
|
+
};
|
|
67901
|
+
var DEFAULT_MEETING_WORK_ITEM_TEXT = "Meetings";
|
|
67902
|
+
var meetingWorkItemText = (cfg, item) => {
|
|
67903
|
+
if (typeof item?.workItemText === "string" && item.workItemText)
|
|
67904
|
+
return item.workItemText;
|
|
67905
|
+
if (typeof cfg?.meetingWorkItemText === "string" && cfg.meetingWorkItemText)
|
|
67906
|
+
return cfg.meetingWorkItemText;
|
|
67907
|
+
return DEFAULT_MEETING_WORK_ITEM_TEXT;
|
|
67908
|
+
};
|
|
67909
|
+
var utcMidnight = (y, m, d) => {
|
|
67910
|
+
const ms = Date.UTC(y, m - 1, d);
|
|
67911
|
+
const check = new Date(ms);
|
|
67912
|
+
return check.getUTCFullYear() === y && check.getUTCMonth() === m - 1 && check.getUTCDate() === d ? ms : null;
|
|
67913
|
+
};
|
|
68036
67914
|
function youTrackParseDuration(text) {
|
|
68037
67915
|
const lower = String(text).toLowerCase().trim();
|
|
68038
67916
|
let total = 0;
|
|
@@ -68048,7 +67926,7 @@ function youTrackParseDuration(text) {
|
|
|
68048
67926
|
}
|
|
68049
67927
|
function youTrackWorkDateMs(dateRaw) {
|
|
68050
67928
|
const cfgPath = youTrackConfigPath();
|
|
68051
|
-
let
|
|
67929
|
+
let effective = effectiveWorkTimezone(null);
|
|
68052
67930
|
if (fs12.existsSync(cfgPath)) {
|
|
68053
67931
|
let parsed;
|
|
68054
67932
|
try {
|
|
@@ -68059,31 +67937,31 @@ function youTrackWorkDateMs(dateRaw) {
|
|
|
68059
67937
|
if (!isConfigObject(parsed)) {
|
|
68060
67938
|
return { error: `${cfgPath} is not a JSON object` };
|
|
68061
67939
|
}
|
|
68062
|
-
|
|
67940
|
+
effective = effectiveWorkTimezone(parsed);
|
|
68063
67941
|
}
|
|
67942
|
+
const tz = effective.timezone;
|
|
67943
|
+
const meta = { timezone: tz, timezoneSource: effective.source };
|
|
68064
67944
|
const raw = dateRaw || "auto";
|
|
68065
67945
|
try {
|
|
68066
|
-
if (raw === "auto"
|
|
68067
|
-
const
|
|
68068
|
-
const
|
|
68069
|
-
|
|
68070
|
-
|
|
67946
|
+
if (raw === "auto") {
|
|
67947
|
+
const { y, m, d } = tzParts(new Date, tz);
|
|
67948
|
+
const dateMs = utcMidnight(Number(y), Number(m), Number(d));
|
|
67949
|
+
if (dateMs === null)
|
|
67950
|
+
return { error: "could not resolve date" };
|
|
67951
|
+
return { data: { dateMs, ...meta, localDate: `${y}-${m}-${d}` } };
|
|
68071
67952
|
}
|
|
68072
67953
|
if (/^\d+$/.test(raw)) {
|
|
68073
67954
|
const dt = new Date(Number(raw));
|
|
68074
|
-
|
|
68075
|
-
|
|
68076
|
-
|
|
68077
|
-
|
|
68078
|
-
const
|
|
68079
|
-
const dateMs =
|
|
68080
|
-
|
|
68081
|
-
|
|
68082
|
-
|
|
68083
|
-
|
|
68084
|
-
localDate: `${y}-${String(m).padStart(2, "0")}-${String(d).padStart(2, "0")}`
|
|
68085
|
-
}
|
|
68086
|
-
};
|
|
67955
|
+
if (Number.isNaN(dt.getTime()))
|
|
67956
|
+
return { error: `invalid date: ${raw}` };
|
|
67957
|
+
return { data: { dateMs: Number(raw), ...meta, localDate: dt.toISOString().slice(0, 10) } };
|
|
67958
|
+
}
|
|
67959
|
+
const match = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(raw);
|
|
67960
|
+
const dateMs = match ? utcMidnight(Number(match[1]), Number(match[2]), Number(match[3])) : null;
|
|
67961
|
+
if (!match || dateMs === null)
|
|
67962
|
+
return { error: `invalid date: ${raw} (expected YYYY-MM-DD)` };
|
|
67963
|
+
const localDate = `${match[1]}-${match[2].padStart(2, "0")}-${match[3].padStart(2, "0")}`;
|
|
67964
|
+
return { data: { dateMs, ...meta, localDate } };
|
|
68087
67965
|
} catch (err) {
|
|
68088
67966
|
return { error: err instanceof Error ? err.message : "could not resolve date" };
|
|
68089
67967
|
}
|
|
@@ -68205,13 +68083,11 @@ function parseIssueRef(input) {
|
|
|
68205
68083
|
}
|
|
68206
68084
|
var defaultScripts = {
|
|
68207
68085
|
config: () => youTrackConfigLoad(),
|
|
68208
|
-
greeting: () => youTrackGreeting(),
|
|
68209
68086
|
parseDuration: (text) => youTrackParseDuration(text),
|
|
68210
68087
|
api: (args) => youTrackApi(args, process.env.WORKFLOW_YT_WRITE ?? "")
|
|
68211
68088
|
};
|
|
68212
68089
|
var contextScripts = {
|
|
68213
68090
|
config: readYouTrackContextConfig,
|
|
68214
|
-
greeting: () => youTrackGreeting(youTrackReadOnlyConfigPath()),
|
|
68215
68091
|
parseDuration: (text) => youTrackParseDuration(text),
|
|
68216
68092
|
api: () => ({ error: "YouTrack context is read-only" })
|
|
68217
68093
|
};
|
|
@@ -68243,7 +68119,7 @@ function meetingOptionsFromConfig(cfg) {
|
|
|
68243
68119
|
key,
|
|
68244
68120
|
issue: item.issue,
|
|
68245
68121
|
label: item.label ?? item.issue,
|
|
68246
|
-
workItemText: item
|
|
68122
|
+
workItemText: meetingWorkItemText(cfg, item),
|
|
68247
68123
|
url: item.url ?? (base && item.issue ? `${base}/issue/${item.issue}` : null)
|
|
68248
68124
|
}));
|
|
68249
68125
|
}
|
|
@@ -68253,7 +68129,7 @@ function meetingOptionsFromConfig(cfg) {
|
|
|
68253
68129
|
key: "general",
|
|
68254
68130
|
issue,
|
|
68255
68131
|
label: "General meetings",
|
|
68256
|
-
workItemText:
|
|
68132
|
+
workItemText: meetingWorkItemText(cfg),
|
|
68257
68133
|
url: base && issue ? `${base}/issue/${issue}` : null
|
|
68258
68134
|
}
|
|
68259
68135
|
];
|
|
@@ -68275,17 +68151,9 @@ var readOnlyYouTrackConfig = (cfg) => {
|
|
|
68275
68151
|
const baseUrl = publicUrl(cfg.baseUrl);
|
|
68276
68152
|
if (baseUrl)
|
|
68277
68153
|
safe.baseUrl = baseUrl;
|
|
68278
|
-
for (const key of ["timezone", "
|
|
68154
|
+
for (const key of ["timezone", "meetingIssue", "meetingWorkItemText"])
|
|
68279
68155
|
if (typeof cfg[key] === "string")
|
|
68280
68156
|
safe[key] = cfg[key];
|
|
68281
|
-
if (cfg.greetings && typeof cfg.greetings === "object" && !Array.isArray(cfg.greetings)) {
|
|
68282
|
-
const greetings = {};
|
|
68283
|
-
for (const key of ["morning", "afternoon"])
|
|
68284
|
-
if (typeof cfg.greetings[key] === "string")
|
|
68285
|
-
greetings[key] = cfg.greetings[key];
|
|
68286
|
-
if (Object.keys(greetings).length)
|
|
68287
|
-
safe.greetings = greetings;
|
|
68288
|
-
}
|
|
68289
68157
|
if (cfg.meetingIssues && typeof cfg.meetingIssues === "object" && !Array.isArray(cfg.meetingIssues)) {
|
|
68290
68158
|
safe.meetingIssues = Object.fromEntries(Object.entries(cfg.meetingIssues).flatMap(([key, value]) => {
|
|
68291
68159
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
@@ -68315,16 +68183,12 @@ function context({
|
|
|
68315
68183
|
const cfg = scripts.config();
|
|
68316
68184
|
if (cfg.error)
|
|
68317
68185
|
return { error: cfg.error };
|
|
68318
|
-
const greeting = scripts.greeting();
|
|
68319
|
-
if (greeting.exitCode !== 0) {
|
|
68320
|
-
return { error: (greeting.stderr || greeting.stdout || "greeting failed").trim() };
|
|
68321
|
-
}
|
|
68322
68186
|
const safeConfig = readOnlyYouTrackConfig(cfg.data);
|
|
68323
68187
|
const meetingOptions = meetingOptionsFromConfig(safeConfig);
|
|
68324
68188
|
if (mode === "meetings" && !issue_id && !issue_url && !issue_ref) {
|
|
68325
68189
|
return {
|
|
68326
68190
|
config: safeConfig,
|
|
68327
|
-
|
|
68191
|
+
workTimezone: effectiveWorkTimezone(safeConfig),
|
|
68328
68192
|
mode: "meetings",
|
|
68329
68193
|
requiresMeetingChoice: true,
|
|
68330
68194
|
meetingOptions,
|
|
@@ -68353,7 +68217,7 @@ function context({
|
|
|
68353
68217
|
const selectedMeeting = meetingOptions.find((m) => m.issue === issue);
|
|
68354
68218
|
return {
|
|
68355
68219
|
config: safeConfig,
|
|
68356
|
-
|
|
68220
|
+
workTimezone: effectiveWorkTimezone(safeConfig),
|
|
68357
68221
|
issueId: issue,
|
|
68358
68222
|
issueUrl,
|
|
68359
68223
|
mode: mode ?? (selectedMeeting ? "meetings" : "task"),
|
|
@@ -68898,6 +68762,11 @@ var actionProposalQuestion = (request, descriptorPayload) => {
|
|
|
68898
68762
|
const cwd = descriptorPayload?.cwd;
|
|
68899
68763
|
return typeof cwd === "string" ? { ...proposal, presented: `${proposal.presented} Target directory: ${cwd}` } : proposal;
|
|
68900
68764
|
};
|
|
68765
|
+
var workDateOf = (data) => ({
|
|
68766
|
+
localDate: data.localDate,
|
|
68767
|
+
timezone: data.timezone,
|
|
68768
|
+
timezoneSource: data.timezoneSource
|
|
68769
|
+
});
|
|
68901
68770
|
var approvedResolvedExternalAction = (content) => {
|
|
68902
68771
|
try {
|
|
68903
68772
|
const value = JSON.parse(content);
|
|
@@ -69735,6 +69604,7 @@ var resolveExternalActionAtRoot = (root, request, preservedDateMs) => {
|
|
|
69735
69604
|
return success(null, null, {
|
|
69736
69605
|
request,
|
|
69737
69606
|
marker,
|
|
69607
|
+
workDate: workDateOf(date.data),
|
|
69738
69608
|
descriptorPayload: {
|
|
69739
69609
|
...request.payload,
|
|
69740
69610
|
resolved: {
|
|
@@ -69771,6 +69641,7 @@ var resolveExternalActionAtRoot = (root, request, preservedDateMs) => {
|
|
|
69771
69641
|
return success(null, null, {
|
|
69772
69642
|
request,
|
|
69773
69643
|
marker,
|
|
69644
|
+
workDate: workDateOf(date.data),
|
|
69774
69645
|
descriptorPayload: {
|
|
69775
69646
|
...request.payload,
|
|
69776
69647
|
resolved: {
|
|
@@ -70634,7 +70505,8 @@ async function runActionCommand(argv, deps = {}) {
|
|
|
70634
70505
|
const result = success(null, null, {
|
|
70635
70506
|
operation: normalized.operation,
|
|
70636
70507
|
descriptor,
|
|
70637
|
-
payload: normalized.payload
|
|
70508
|
+
payload: normalized.payload,
|
|
70509
|
+
...resolved.data.workDate ? { workDate: resolved.data.workDate } : {}
|
|
70638
70510
|
});
|
|
70639
70511
|
if (json)
|
|
70640
70512
|
jsonResult(outOf(deps), result);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainervirus/workit-cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
|
|
6
6
|
"keywords": [
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"typecheck": "tsc --noEmit"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@brainervirus/workit-core": "^2.1.
|
|
41
|
-
"@brainervirus/workit-cursor": "^2.1.
|
|
42
|
-
"@brainervirus/workit-opencode": "^2.1.
|
|
40
|
+
"@brainervirus/workit-core": "^2.1.3",
|
|
41
|
+
"@brainervirus/workit-cursor": "^2.1.3",
|
|
42
|
+
"@brainervirus/workit-opencode": "^2.1.3",
|
|
43
43
|
"@inkjs/ui": "2.0.0",
|
|
44
44
|
"ink": "7.1.1",
|
|
45
45
|
"react": "19.2.8"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{{greetingText}}
|