@goodtek/vibeops 3.1.5 → 3.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to VibeOps are documented here.
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 3.1.6 - 2026-10-17
8
+
9
+ ### Fixed
10
+
11
+ - **`task release` failed when the release PR was already open.** It now reuses the open integration → production PR; a failing lookup refuses. The dry-run now says the merge waits for the PR's own CI runs (it already did since 3.1.2) and shows `requiredChecks` as an extra by-name list (TASK-030).
12
+ - **An unreadable Git Context was skipped quietly.** `task ship` printed "push/MR skipped" and exited 0; it now exits 1 before committing or pushing and names the problem (e.g. ``line 160 is `## ## Git Context` ``). `task add` no longer "resumes" an In Progress TASK whose Git Context is damaged — that wrote a second section and blocked new TASKs in every worktree (TASK-030).
13
+
7
14
  ## 3.1.5 - 2026-10-16
8
15
 
9
16
  ### Fixed
package/README.md CHANGED
@@ -158,7 +158,7 @@ vibeops llm use auto # auto | codex-oauth | cursor-agent | openai
158
158
  - **`task merge`**: merge MR/PR into integration (TASK md unchanged) — **only when every check is green** (see [Merge gate](#merge-gate)).
159
159
  - **`task sync`**: verify merge → leave the task branch (switch to integration, or detach at `<remote>/<integration>` when another worktree owns it) → fast-forward local integration where safe → delete local + remote `task/*` branch (TASK md unchanged).
160
160
  - **`pull`**: fetch + switch to integration branch + `git pull --ff-only` (one command). Refuses (exit 1) when another worktree has the integration branch checked out — run it there.
161
- - **`task release`**: integration → production PR + merge (skipped on trunk policy).
161
+ - **`task release`**: integration → production PR + merge (skipped on trunk policy). Reuses the open release PR when there is one; the merge waits for that PR's own CI like `task merge`.
162
162
  - **`status`**: Now / Next card — focus stage, checklist, PR, and the next command to run.
163
163
  - No force-push to shared branches.
164
164
 
@@ -223,6 +223,7 @@ Before calling `gh pr merge` / `glab mr merge`:
223
223
  - **No checks at all → refuse** unless `allowNoChecks: true`. "No checks" means: empty rollup, no GitHub Actions run and no expected workflow for the head commit (GitLab: no pipeline). For CI outside GitHub Actions (commit statuses / check apps), the empty list is re-polled for `emptyRollupGraceSeconds` first; list such checks in `requiredChecks` so the gate waits for them by name.
224
224
  - **Waiting** polls the host (`gh pr view` + the Actions REST API) every `pollIntervalSeconds` (default 10 s, the default of `gh pr checks --watch`) until the state changes, bounded by `waitTimeoutSeconds` (default 900 s). Host read errors back off exponentially with jitter (capped at 60 s, GitHub's guidance for rate-limited clients).
225
225
  - **The merge is pinned to the checked commit:** right before merging the gate re-reads the PR head; if it moved, the new head is evaluated from scratch. The merge itself uses `gh pr merge --match-head-commit <sha>` (requires **gh ≥ 2.13.0**) / `glab mr merge --auto-merge=false --sha <sha>` (verified with glab 1.106), so a push between the last check and the merge makes the host refuse. A GitLab `405` re-runs the gate and retries once with the same flags.
226
+ - **Unreadable Git Context stops `task ship` / `task add`:** a TASK file whose `## Git Context` cannot be read (e.g. an edit left `## ## Git Context`) makes `task ship` exit 1 before committing or pushing, naming the line; `task add` refuses to "resume" such a TASK (it would write a second section) and names the file and line.
226
227
  - **`task merge` refuses a stale base:** the head commit the gate approved must contain the current `<remote>/<base>` (`git merge-base --is-ancestor`, after fetching the base branch and the head commit). A head that does not — the base moved since the branch was pushed, or the branch was rebuilt on an old base (e.g. `git reset --soft <stale origin/develop>` + commit) — can silently revert work merged into the base since, and a squash merge lands that revert. Bring the branch up to date (`git fetch` + `git merge <remote>/<base>`, test, `task ship`), wait for CI, then rerun `task merge`. A fetch failure refuses (fail closed). `task release` does not apply this check (with merge-commit releases the production branch is normally not an ancestor of the integration branch).
227
228
 
228
229
  ### Configuration (`.vibeops.json` → `merge`)
@@ -12,7 +12,7 @@ import { findBlockingTask, relPath } from "../lib/task-context.js";
12
12
  import { allocateTaskId, TaskIdAllocationError } from "../lib/task-id-allocation.js";
13
13
  import { readTaskLockConfig, TaskLockConfigError, TaskLockHeldError, withTaskLock, } from "../lib/task-lock.js";
14
14
  import { isIncompleteTaskStart, startTaskBranch } from "../lib/task-start.js";
15
- import { branchNameForTaskFile, loadActionableTasks, readGitContext } from "../lib/task.js";
15
+ import { branchNameForTaskFile, damagedGitContext, loadActionableTasks, readGitContext, } from "../lib/task.js";
16
16
  async function loadGitConfigOrNull(root, dryRun) {
17
17
  try {
18
18
  return await requireGitConfig(root);
@@ -98,6 +98,15 @@ export async function taskAddCommand(opts = {}) {
98
98
  const blocking = await findBlockingTask(paths, root);
99
99
  // Resume: In Progress file exists but task branch / Git Context was never finished.
100
100
  if (blocking !== null && gitCfg !== null) {
101
+ // A damaged Git Context is not an unfinished add: resuming would write a second section.
102
+ const damaged = await damagedGitContext(blocking.filePath);
103
+ if (damaged !== null) {
104
+ log.error(`${bold(blocking.id)} is In Progress but its Git Context cannot be read: ${damaged}.`);
105
+ log.info(` ${dim("file")} ${relPath(root, blocking.filePath)}`);
106
+ log.info(dim("No TASK was created. Fix the TASK file (then ship it), and rerun task add."));
107
+ process.exitCode = 1;
108
+ return "done";
109
+ }
101
110
  const incomplete = await isIncompleteTaskStart(root, blocking.filePath);
102
111
  if (incomplete) {
103
112
  log.warn(`${yellow("Incomplete")} — ${bold(blocking.id)} exists but the task branch was not created.`);
@@ -5,7 +5,7 @@ import { formatHostCliHint, formatHostCliMissingMessage } from "../lib/git-host-
5
5
  import { detectGitHost, mergeRequestLabel } from "../lib/git-host.js";
6
6
  import { gitRemoteUrl } from "../lib/git.js";
7
7
  import { bold, dim, log } from "../lib/logger.js";
8
- import { createMergeRequest, getMergeRequestState, MergeGateError, mergeMergeRequest, probeMergeRequestCli, } from "../lib/pr-create.js";
8
+ import { createMergeRequest, findMergeRequestByBranches, getMergeRequestState, MergeGateError, mergeMergeRequest, probeMergeRequestCli, } from "../lib/pr-create.js";
9
9
  import { assertMergeRequestMerged } from "../lib/task-merge-verify.js";
10
10
  function resolveReleaseMergeMethod(opts) {
11
11
  if (opts.rebase === true)
@@ -65,9 +65,10 @@ export async function taskReleaseCommand(options = {}) {
65
65
  if (dryRun) {
66
66
  log.info(bold("dry-run — would:"));
67
67
  log.info(` · ${label}: ${integrationBranch} → ${productionBranch}`);
68
+ log.info(` · reuse the open ${label} ${integrationBranch} → ${productionBranch} if there is one`);
68
69
  if (options.noMerge !== true) {
69
- log.info(` · merge ${label} (${resolveReleaseMergeMethod(options)}) only when all checks are green`);
70
- log.info(` · required checks: ${requiredChecks.length > 0 ? requiredChecks.join(", ") : "(none configured)"}`);
70
+ log.info(` · merge ${label} (${resolveReleaseMergeMethod(options)}) only when every check on its head commit is green — waits for the ${label}'s own CI runs`);
71
+ log.info(` · required checks (by name, in addition): ${requiredChecks.length > 0 ? requiredChecks.join(", ") : "none configured"}`);
71
72
  if (mergeCfg.allowNoChecks) {
72
73
  log.info(" · allowNoChecks: true (a release PR with no checks would merge)");
73
74
  }
@@ -84,24 +85,46 @@ export async function taskReleaseCommand(options = {}) {
84
85
  return;
85
86
  }
86
87
  let releaseUrl;
88
+ let open;
87
89
  try {
88
- const { url } = await createMergeRequest({
90
+ open = await findMergeRequestByBranches({
89
91
  cwd,
90
92
  host,
91
- baseBranch: productionBranch,
92
93
  headBranch: integrationBranch,
93
- title,
94
- body,
94
+ baseBranch: productionBranch,
95
+ state: "open",
95
96
  });
96
- releaseUrl = url;
97
- log.ok(`${label}: ${url}`);
98
97
  }
99
98
  catch (e) {
100
- const msg = e instanceof Error ? e.message : String(e);
101
- log.error(`Could not create release ${label}: ${msg}`);
99
+ const msg = e instanceof Error ? e.message.split("\n")[0] : String(e);
100
+ log.error(`Could not look up an open release ${label}: ${msg}`);
102
101
  process.exitCode = 1;
103
102
  return;
104
103
  }
104
+ if (open !== null) {
105
+ releaseUrl = open.url;
106
+ log.ok(`${label} already open — reusing: ${releaseUrl}`);
107
+ }
108
+ else {
109
+ try {
110
+ const { url } = await createMergeRequest({
111
+ cwd,
112
+ host,
113
+ baseBranch: productionBranch,
114
+ headBranch: integrationBranch,
115
+ title,
116
+ body,
117
+ });
118
+ releaseUrl = url;
119
+ log.ok(`${label}: ${url}`);
120
+ }
121
+ catch (e) {
122
+ const msg = e instanceof Error ? e.message : String(e);
123
+ log.error(`Could not create release ${label}: ${msg}`);
124
+ process.exitCode = 1;
125
+ return;
126
+ }
127
+ }
105
128
  if (options.noMerge === true) {
106
129
  log.info(dim("Merge skipped (--no-merge)."));
107
130
  return;
@@ -14,7 +14,7 @@ import { runPostMergeNewCycle } from "../lib/task-new-cycle.js";
14
14
  import { applyTaskShipMemory, fallbackResultSections, llmCompleteTaskShip, writeTaskResultSections, } from "../lib/task-ship-llm.js";
15
15
  import { detectShipPrState, prRefLabel, resolveShipAction, } from "../lib/task-ship-state.js";
16
16
  import { finishTaskWithPullRequest } from "../lib/task-push-pr.js";
17
- import { hasNonEmptySection, parseTaskFilename, readGitContext, readTaskFile, updateInlineStatus, } from "../lib/task.js";
17
+ import { hasNonEmptySection, parseTaskFilename, gitContextProblem, readGitContext, readTaskFile, updateInlineStatus, } from "../lib/task.js";
18
18
  import { assertTaskIdFreeOnRemote } from "../lib/task-id-allocation.js";
19
19
  function describePushFailure(message) {
20
20
  const lower = message.toLowerCase();
@@ -111,6 +111,13 @@ async function runFirstShip(ctx) {
111
111
  process.exitCode = 1;
112
112
  return;
113
113
  }
114
+ const gitCtx = await readGitContext(taskFile);
115
+ if (gitCtx === null) {
116
+ log.error(`No Git Context in ${relPath(cwd, taskFile)}: ${await gitContextProblem(taskFile)}. Nothing was committed or pushed.`);
117
+ log.info(dim("`vibeops task add` writes this section with the task branch; restore it, then rerun task ship."));
118
+ process.exitCode = 1;
119
+ return;
120
+ }
114
121
  if (dryRun) {
115
122
  log.info(bold("dry-run — would:"));
116
123
  if (!resultOk || !testOk) {
@@ -128,8 +135,7 @@ async function runFirstShip(ctx) {
128
135
  });
129
136
  return;
130
137
  }
131
- const gitCtx = await readGitContext(taskFile);
132
- if (gitCtx !== null && !(await ensureOnTaskBranch(cwd, gitCtx, dryRun))) {
138
+ if (!(await ensureOnTaskBranch(cwd, gitCtx, dryRun))) {
133
139
  process.exitCode = 1;
134
140
  return;
135
141
  }
@@ -150,10 +156,6 @@ async function runFirstShip(ctx) {
150
156
  });
151
157
  await commitDirtyWorkingTree(cwd, message, false);
152
158
  }
153
- if (gitCtx === null) {
154
- log.info(dim("No Git Context — push/MR skipped."));
155
- return;
156
- }
157
159
  await commitShipMetadata({ cwd, taskFile, taskId: parts.id, dryRun: false });
158
160
  const prResult = await finishTaskWithPullRequest({
159
161
  cwd,
@@ -183,7 +185,7 @@ async function runUpdateOpenPr(ctx) {
183
185
  const { cwd, taskId, taskFile, meta, body, prCtx, dryRun, nonInteractive, options } = ctx;
184
186
  const gitCtx = await readGitContext(taskFile);
185
187
  if (gitCtx === null) {
186
- log.error("No Git Context — cannot update the open PR.");
188
+ log.error(`No Git Context — cannot update the open PR: ${await gitContextProblem(taskFile)}.`);
187
189
  process.exitCode = 1;
188
190
  return;
189
191
  }
package/dist/lib/task.js CHANGED
@@ -221,6 +221,25 @@ function locateSection(text, title, level = 2) {
221
221
  }
222
222
  return null;
223
223
  }
224
+ /**
225
+ * A line that looks like the `## <title>` heading but is not one (e.g. `## ## Git Context`
226
+ * or `#Git Context`), when no well-formed heading exists. 1-based line number, or `null`.
227
+ */
228
+ export function findMalformedSectionHeading(text, title, level = 2) {
229
+ if (locateSection(text, title, level) !== null)
230
+ return null;
231
+ const want = title.toLowerCase();
232
+ const lines = text.split("\n");
233
+ for (let i = 0; i < lines.length; i++) {
234
+ const line = lines[i];
235
+ if (!/^\s*#/.test(line))
236
+ continue;
237
+ const name = line.replace(/^[\s#]+/, "").replace(/[\s#]+$/, "").toLowerCase();
238
+ if (name === want)
239
+ return { line: i + 1, text: line.trim() };
240
+ }
241
+ return null;
242
+ }
224
243
  export function readSection(body, title) {
225
244
  const block = locateSection(body, title);
226
245
  if (block === null)
@@ -420,6 +439,30 @@ export async function upsertGitContext(filePath, ctx) {
420
439
  await writeText(filePath, updated);
421
440
  }
422
441
  }
442
+ /**
443
+ * The Git Context exists but cannot be read (malformed heading, or the section lacks
444
+ * its fields): the problem text, else `null` (readable, or no section at all).
445
+ */
446
+ export async function damagedGitContext(filePath) {
447
+ if ((await readGitContext(filePath)) !== null)
448
+ return null;
449
+ const raw = await readText(filePath);
450
+ const malformed = findMalformedSectionHeading(raw, "Git Context") !== null;
451
+ const unparsable = readSection(raw, "Git Context").length > 0;
452
+ return malformed || unparsable ? gitContextProblem(filePath) : null;
453
+ }
454
+ /** Why {@link readGitContext} returned `null` for this file — for error messages. */
455
+ export async function gitContextProblem(filePath) {
456
+ const raw = await readText(filePath);
457
+ const bad = findMalformedSectionHeading(raw, "Git Context");
458
+ if (bad !== null) {
459
+ return `line ${bad.line} is \`${bad.text}\`, not \`## Git Context\` — fix that heading`;
460
+ }
461
+ if (readSection(raw, "Git Context").length === 0) {
462
+ return "the file has no `## Git Context` section";
463
+ }
464
+ return "`## Git Context` lacks Base Branch / Base Commit / Task Branch / Started At";
465
+ }
423
466
  const GIT_CTX_RE = {
424
467
  baseBranch: /^-\s+Base Branch:\s*`([^`]+)`/m,
425
468
  baseCommit: /^-\s+Base Commit:\s*`([^`]+)`/m,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodtek/vibeops",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "Minimal CLI rails for Cursor-based TASK-driven vibe coding.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@9.15.9",