@brainervirus/workit-opencode 8.14.1 → 8.15.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.
@@ -33,8 +33,8 @@ that repeats because the base keeps moving, or after 3 failed fix attempts on
33
33
  the same check.
34
34
 
35
35
  1. **Open.** `workit git push`, then `workit pr create --title "<title>"
36
- --body-file <f|->` (idempotent; body: `references/pr-body.md`; edits:
37
- `workit pr edit`). A stack: `workit stack plan <bottom> ... <top>`, one
36
+ --body-file <f|->` plus `--issue <#n|ID>` per issue (`--refs`: no close; idempotent;
37
+ body: `references/pr-body.md`; edits: `workit pr edit`). A stack: `workit stack plan <bottom> ... <top>`, one
38
38
  `workit pr create --base <parent> --fill` per branch, then
39
39
  `workit stack sync`. Finish the whole stack before babysitting any PR.
40
40
  2. **Read state** with `workit pr status --json`. `REVIEW` alone is a pending
package/dist/plugin.js CHANGED
@@ -13186,20 +13186,19 @@ var workspaceConfigSchema = object({
13186
13186
  union([boolean2(), literal("verified")]).optional()
13187
13187
  ]))).passthrough().optional(),
13188
13188
  youtrack: object({ baseUrl: nonBlank.optional(), link_issues: boolean2().optional() }).passthrough().optional(),
13189
- issues: object({ provider: literal("github").optional(), link_on_pr: boolean2().optional() }).passthrough().optional(),
13189
+ issues: object({
13190
+ provider: _enum(["github", "gitlab", "youtrack"]).optional(),
13191
+ link: boolean2().optional(),
13192
+ relation: unknown().optional(),
13193
+ backlink: boolean2().optional(),
13194
+ link_on_pr: boolean2().optional()
13195
+ }).passthrough().optional(),
13190
13196
  branchPolicy: workspaceBranchPolicySchema.optional(),
13191
13197
  commitPolicy: workspaceCommitPolicySchema.optional(),
13192
13198
  defaultProfile: nonBlank.optional(),
13193
13199
  profiles: record(nonBlank, workspaceProfileSchema).optional(),
13194
13200
  releaseTracks: record(nonBlank, releaseTrackSchema).optional()
13195
13201
  }).passthrough().superRefine((workspace, context) => {
13196
- if (workspace.issues && workspace.vcs?.provider !== "github") {
13197
- context.addIssue({
13198
- code: "custom",
13199
- path: ["issues"],
13200
- message: `GitHub issue linking requires the github provider, got ${workspace.vcs?.provider ?? "unset"}`
13201
- });
13202
- }
13203
13202
  if (workspace.defaultProfile !== undefined && !Object.hasOwn(workspace.profiles ?? {}, workspace.defaultProfile)) {
13204
13203
  context.addIssue({
13205
13204
  code: "custom",
@@ -14066,6 +14065,44 @@ var readVcsConfig = () => {
14066
14065
  }
14067
14066
  return { status: "malformed", path: file, config: {}, error: `${file} is not a JSON object` };
14068
14067
  };
14068
+ var TRACKERS = new Set(["github", "gitlab", "youtrack"]);
14069
+ var asRecord = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
14070
+ var flag = (value) => typeof value === "boolean" ? value : null;
14071
+ var text2 = (value) => typeof value === "string" && value.trim() ? value.trim() : null;
14072
+ function issueTrackerOf(issues, youtrack) {
14073
+ const iss = asRecord(issues);
14074
+ const yt = asRecord(youtrack);
14075
+ const warnings = [];
14076
+ const named = typeof iss.provider === "string" && TRACKERS.has(iss.provider.toLowerCase()) ? iss.provider.toLowerCase() : null;
14077
+ if (iss.relation !== undefined && iss.relation !== "closes" && iss.relation !== "refs")
14078
+ warnings.push(`issues.relation ${JSON.stringify(iss.relation)} is not closes or refs; read as closes`);
14079
+ for (const key of ["repo", "host"])
14080
+ if (iss[key] !== undefined && text2(iss[key]) === null)
14081
+ warnings.push(`issues.${key} is not a non-empty string; ignored`);
14082
+ const common = {
14083
+ relation: iss.relation === "refs" ? "refs" : "closes",
14084
+ backlink: iss.backlink === true,
14085
+ baseUrl: text2(yt.baseUrl),
14086
+ repo: text2(iss.repo)?.replace(/^\/+|\/+$/gu, "") ?? null,
14087
+ host: text2(iss.host)?.toLowerCase() ?? null,
14088
+ warnings
14089
+ };
14090
+ const legacyGithub = named === "github" && flag(iss.link) === null;
14091
+ if (flag(yt.link_issues) === true && (named === null || legacyGithub))
14092
+ return { provider: "youtrack", link: true, ...common, source: "youtrack.link_issues" };
14093
+ if (named) {
14094
+ const link = flag(iss.link) ?? flag(iss.link_on_pr) ?? (named === "youtrack" ? flag(yt.link_issues) : null) ?? false;
14095
+ return {
14096
+ provider: named,
14097
+ link,
14098
+ ...common,
14099
+ source: flag(iss.link) === null && flag(iss.link_on_pr) !== null ? "issues.link_on_pr" : "issues"
14100
+ };
14101
+ }
14102
+ if (common.baseUrl)
14103
+ return { provider: "youtrack", link: false, ...common, source: "youtrack.baseUrl" };
14104
+ return null;
14105
+ }
14069
14106
  var trackSummary = (resolution) => resolution.status === "resolved" ? {
14070
14107
  name: resolution.track?.name ?? null,
14071
14108
  source: resolution.source,
@@ -14086,6 +14123,7 @@ function vcsConfig(mode, cwd, options = {}) {
14086
14123
  const rawProvider = wsVcs.provider ?? (determinateRoot ? remoteProvider(root) : null) ?? cfg.provider ?? null;
14087
14124
  const provider = rawProvider === null || rawProvider === undefined ? null : String(rawProvider).toLowerCase() || null;
14088
14125
  const workspaceDefault = workspaceDefaultTarget(root, cfg.defaultTargetBranch);
14126
+ const issueTracker = issueTrackerOf(wsIssues, wsYt);
14089
14127
  const linkIssues = typeof wsYt.link_issues === "boolean" ? wsYt.link_issues : null;
14090
14128
  const youtrackBaseUrl = typeof wsYt.baseUrl === "string" ? wsYt.baseUrl : null;
14091
14129
  let issuesProvider = null;
@@ -14118,7 +14156,8 @@ function vcsConfig(mode, cwd, options = {}) {
14118
14156
  link_issues: linkIssues,
14119
14157
  youtrack_base_url: youtrackBaseUrl,
14120
14158
  issues_provider: issuesProvider,
14121
- link_on_pr: linkOnPr
14159
+ link_on_pr: linkOnPr,
14160
+ issue_tracker: issueTracker
14122
14161
  };
14123
14162
  }
14124
14163
  if (cfgStatus === "malformed") {
@@ -14144,7 +14183,8 @@ function vcsConfig(mode, cwd, options = {}) {
14144
14183
  link_issues: linkIssues,
14145
14184
  youtrack_base_url: youtrackBaseUrl,
14146
14185
  issues_provider: issuesProvider,
14147
- link_on_pr: linkOnPr
14186
+ link_on_pr: linkOnPr,
14187
+ issue_tracker: issueTracker
14148
14188
  };
14149
14189
  if (provider === "gitlab") {
14150
14190
  out.gitlab = {
@@ -14248,7 +14288,12 @@ var MAX_LINE_BYTES = 4096;
14248
14288
  var PASSING = new Set(["verified", "tests-verified", "type-check-only"]);
14249
14289
  var FAILING = new Set(["failed", "blocked"]);
14250
14290
  var STRONG_RESULTS = new Set(["verified", "tests-verified"]);
14251
- var PR_ROW_TYPES = new Set(["pr.created", "pr.status", "pr.merged"]);
14291
+ var PR_ROW_TYPES = new Set([
14292
+ "pr.created",
14293
+ "pr.status",
14294
+ "pr.merged",
14295
+ "pr.linked"
14296
+ ]);
14252
14297
  var err = (code, error, unblock) => ({
14253
14298
  ok: false,
14254
14299
  code,
@@ -18533,7 +18578,7 @@ var RISK = {
18533
18578
  };
18534
18579
  var YES = new Set(["true", "yes", "y", "1", "on"]);
18535
18580
  var NO = new Set(["false", "no", "n", "0", "off", "none"]);
18536
- var flag = (value, unknownAs) => {
18581
+ var flag2 = (value, unknownAs) => {
18537
18582
  if (typeof value === "boolean")
18538
18583
  return { ok: true, value };
18539
18584
  if (typeof value === "number" && (value === 0 || value === 1))
@@ -18599,12 +18644,12 @@ function normalizeJudgment(raw, previous) {
18599
18644
  const items = Array.isArray(value) ? value : [value];
18600
18645
  judgment.refs.push(...items.filter((item) => item !== null && item !== "").map(refOf));
18601
18646
  } else {
18602
- if (name === "needsPlan" && typeof value === "string" && !flag(value, false).ok && value.trim()) {
18647
+ if (name === "needsPlan" && typeof value === "string" && !flag2(value, false).ok && value.trim()) {
18603
18648
  judgment.needsPlan = true;
18604
18649
  judgment.refs.push(refOf(value.trim()));
18605
18650
  continue;
18606
18651
  }
18607
- const parsed = flag(value, name === "behaviorChange");
18652
+ const parsed = flag2(value, name === "behaviorChange");
18608
18653
  if (parsed.ok)
18609
18654
  judgment[name] = parsed.value;
18610
18655
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-opencode",
3
- "version": "8.14.1",
3
+ "version": "8.15.0",
4
4
  "private": false,
5
5
  "description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
6
6
  "keywords": [
@@ -39,7 +39,7 @@
39
39
  "typecheck": "tsc --noEmit"
40
40
  },
41
41
  "devDependencies": {
42
- "@brainervirus/workit-core": "^8.14.1",
42
+ "@brainervirus/workit-core": "^8.15.0",
43
43
  "@opencode/plugin": "2.0.18"
44
44
  },
45
45
  "engines": {