hivecode-mcp 0.14.9 → 0.14.11

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/hive-gh-action.js CHANGED
@@ -107,7 +107,9 @@ export async function roomDeps({ link, root, branch, github }) {
107
107
  assignFix: async (text) => { const r = await openRoom(link); try { r.hive.assign('all', text) } finally { await r.close(1500) } },
108
108
  say: (text) => RW.roomSay({ link, text }),
109
109
  postIssue: (issue) => RM.postIssue({ link, issue, waysOfWorking: RW.WAYS_OF_WORKING, branch }),
110
- landIssue: (o) => RM.landIssue({ link, root, branch, ...(github ? { github } : {}), ...o }),
110
+ // THE JOB'S TOKEN CANNOT READ /user (GitHub answers 403 "Resource not accessible by integration"),
111
+ // and the landing asks it as its login check. The token is the job's; there is no person to check.
112
+ landIssue: (o) => RM.landIssue({ link, root, branch, ...(github ? { github: { ...github, user: () => ({ login: 'github-actions[bot]' }) } } : {}), ...o }),
111
113
  prFeedback: (o) => RM.postPrFeedback({ link, root, branch, quietMs: 0, ...o }),
112
114
  bind: async () => {
113
115
  const HB = await import('./hive-branch.js')
@@ -225,7 +227,24 @@ export async function runAction({ gh, deps, eventName = '', event = {}, branch,
225
227
  const tasks = await deps.tasks()
226
228
  const task = issueTasks(tasks, n)[0]
227
229
  if (!task) { note(`#${n}: its task is not in the room (the relay lost the room?); nothing to land`); return { did } }
228
- const openPr = pulls.find((p) => p.state === 'open' && closesOf(p.body) === n) || null
230
+ let openPr = pulls.find((p) => p.state === 'open' && closesOf(p.body) === n) || null
231
+ // A PULL REQUEST ON THE BRANCH THAT SOMEONE ELSE OPENED (an agent's hive_pr, a person) is this
232
+ // issue's: the room lands on one branch, one issue at a time. It is told so ("Closes #N" goes in
233
+ // first), so merging it closes the issue and the next run sees it as the issue's.
234
+ if (!openPr) {
235
+ const other = pulls.find((p) => p.state === 'open' && !closesOf(p.body))
236
+ if (other) {
237
+ try {
238
+ gh.updatePull(other.number, { body: `Closes #${n}\n\n${String(other.body || '')}` })
239
+ other.body = `Closes #${n}\n\n${String(other.body || '')}`
240
+ openPr = other
241
+ comment(n, `#${other.number} is this issue's pull request: it was opened on the room's branch, so Hivecode linked it.\n\n${MARK('adopted', { pr: other.number })}`)
242
+ await deps.say(`@all PR #${other.number} on the room's branch is now issue #${n}'s pull request (it closes #${n} when merged).`)
243
+ await tell(`PR #${other.number} is now the pull request for issue #${n}.`)
244
+ note(`#${n}: linked PR #${other.number}`)
245
+ } catch (e) { note(`#${n}: could not link PR #${other.number}: ${oneLine(e.message, 160)}`) }
246
+ }
247
+ }
229
248
  const cs = commentsOf(n)
230
249
  const lastLand = cs.map((c) => markOf(c.body, 'land')).filter(Boolean).pop() || null
231
250
  if (task.status === 'done') {
@@ -267,7 +286,10 @@ export async function runAction({ gh, deps, eventName = '', event = {}, branch,
267
286
  if (sha) {
268
287
  const GH = await import('./hive-github.js')
269
288
  // The job's own run is not a check on the pull request; the rest are.
270
- const v = GH.ciVerdict(gh.checkRuns(sha), gh.statuses(sha))
289
+ // A check that cannot be read (an older workflow file without `statuses: read`) is said in the
290
+ // log, never a failed run: everything before it already happened.
291
+ let v = { state: 'none', failed: [] }
292
+ try { v = GH.ciVerdict(gh.checkRuns(sha), gh.statuses(sha)) } catch (e) { note(`PR #${openPr.number}: the checks could not be read (${oneLine(e.message, 160)}); add "statuses: read" and "checks: read" to the workflow's permissions`) }
271
293
  const short = String(sha).slice(0, 7)
272
294
  const marker = `Fix the failing checks on PR #${openPr.number} at ${short}`
273
295
  if (v.state === 'failure' && !tasks.some((t) => t && t.by === 'GitHub' && String(t.text || '').startsWith(marker))) {
@@ -307,6 +329,7 @@ permissions:
307
329
  issues: write
308
330
  pull-requests: write
309
331
  checks: read
332
+ statuses: read
310
333
 
311
334
  # One run at a time: two runs never post the same issue or land twice.
312
335
  concurrency:
@@ -368,7 +391,7 @@ export async function main(argv = [], { cwd = process.cwd(), env = process.env,
368
391
  try { if (env.GITHUB_EVENT_PATH) event = JSON.parse(fs.readFileSync(env.GITHUB_EVENT_PATH, 'utf8')) } catch { }
369
392
  let base = String(env.HIVE_BASE || '').trim()
370
393
  if (!base) { try { base = gh.repoInfo().default_branch || '' } catch { } }
371
- const deps = await roomDeps({ link, root, branch })
394
+ const deps = await roomDeps({ link, root, branch, github: gh })
372
395
  try {
373
396
  const W = await import('./hive-webhook.js')
374
397
  const notify = W.makeNotifier(String(env.HIVE_NOTIFY_WEBHOOK || '').trim(), { log })
package/hive-github.js CHANGED
@@ -159,6 +159,7 @@ export function makeGitHub({ call, owner, repo, now = () => Date.now() }) {
159
159
  pull: (n) => req('GET', `${base}/pulls/${n}`),
160
160
  pullsFor: (branch) => list(`${base}/pulls?state=all&head=${encodeURIComponent(`${owner}:${branch}`)}`),
161
161
  createPull: (p) => req('POST', `${base}/pulls`, p),
162
+ updatePull: (n, p) => req('PATCH', `${base}/pulls/${n}`, p),
162
163
  checkRuns: (sha) => (req('GET', `${base}/commits/${sha}/check-runs?per_page=100&filter=latest`) || {}).check_runs || [],
163
164
  statuses: (sha) => (req('GET', `${base}/commits/${sha}/status`) || {}).statuses || [],
164
165
  reviews: (n) => list(`${base}/pulls/${n}/reviews`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hivecode-mcp",
3
- "version": "0.14.9",
3
+ "version": "0.14.11",
4
4
  "description": "MCP server that lets any AI coding agent join a Hivecode room — humans and multiple AI agents edit one live codebase with folder-scoped permissions and approval gates.",
5
5
  "type": "module",
6
6
  "license": "MIT",