@neriros/ralphy 2.13.11 → 2.13.12

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +47 -5
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -70515,6 +70515,27 @@ async function fetchIssueLabels(apiKey, teamKey) {
70515
70515
  });
70516
70516
  return data.issueLabels.nodes;
70517
70517
  }
70518
+ async function fetchTeamIdByKey(apiKey, teamKey) {
70519
+ const query = `query TeamId($key: String!) {
70520
+ teams(filter: { key: { eq: $key } }, first: 1) {
70521
+ nodes { id }
70522
+ }
70523
+ }`;
70524
+ const data = await linearRequest(apiKey, query, {
70525
+ key: teamKey
70526
+ });
70527
+ return data.teams.nodes[0]?.id ?? null;
70528
+ }
70529
+ async function createIssueLabel(apiKey, teamId, name) {
70530
+ const mutation = `mutation CreateLabel($teamId: String!, $name: String!) {
70531
+ issueLabelCreate(input: { teamId: $teamId, name: $name }) {
70532
+ success
70533
+ issueLabel { id }
70534
+ }
70535
+ }`;
70536
+ const data = await linearRequest(apiKey, mutation, { teamId, name });
70537
+ return data.issueLabelCreate.issueLabel?.id ?? null;
70538
+ }
70518
70539
  async function addLabelToIssue(apiKey, issueId, labelId) {
70519
70540
  const mutation = `mutation AddLabel($id: String!, $labelId: String!) {
70520
70541
  issueAddLabel(id: $id, labelId: $labelId) { success }
@@ -71404,9 +71425,9 @@ ${reBlob.trim()}`);
71404
71425
  continue;
71405
71426
  }
71406
71427
  }
71407
- if (!isHookReject || hookFixAttempt >= maxHookFixAttempts) {
71428
+ if (!pushRejected || hookFixAttempt >= maxHookFixAttempts) {
71408
71429
  if (pushRejected) {
71409
- log2(`! push rejected for ${changeName} after ${hookFixAttempt} hook-fix attempts (host pre-push hook still failing) \u2014 worktree preserved at ${cwd2}`, "red");
71430
+ log2(`! push rejected for ${changeName} after ${hookFixAttempt} fix attempts (push still failing) \u2014 worktree preserved at ${cwd2}`, "red");
71410
71431
  log2(` detail: ${detail}`, "red");
71411
71432
  } else {
71412
71433
  log2(`! PR create failed for ${changeName}: ${detail}`, "red");
@@ -71419,7 +71440,7 @@ ${reBlob.trim()}`);
71419
71440
  emit("push-retry", `${hookFixAttempt}/${maxHookFixAttempts}`);
71420
71441
  log2(`! push rejected for ${changeName} \u2014 prepending fix task and re-running loop (attempt ${hookFixAttempt}/${maxHookFixAttempts})`, "yellow");
71421
71442
  log2(` detail: ${detail}`, "yellow");
71422
- const retryCode = await runWorkerWithFixTask("Fix host pre-push hook rejection", `Push to origin/${branch} was rejected by the host repo's pre-push hook. ` + `Fix the underlying problem, then the push will be retried.
71443
+ const retryCode = await runWorkerWithFixTask("Fix push rejection", `Push to origin/${branch} was rejected. Fix the underlying problem ` + `(e.g. failing pre-push hook checks), then the push will be retried.
71423
71444
 
71424
71445
  ` + combined.trim());
71425
71446
  if (retryCode !== 0) {
@@ -71607,6 +71628,7 @@ function buildAgentCoordinator(input) {
71607
71628
  const cmdRunner = input.runners?.cmd ?? bunCmdRunner;
71608
71629
  const stateCache = new Map;
71609
71630
  const labelCache = new Map;
71631
+ const teamIdCache = new Map;
71610
71632
  const teamKeyOf = (issue) => issue.identifier.split("-")[0];
71611
71633
  async function resolveStateId(issue, name) {
71612
71634
  const t = teamKeyOf(issue);
@@ -71626,7 +71648,27 @@ function buildAgentCoordinator(input) {
71626
71648
  map2 = new Map(labels.map((l) => [l.name.toLowerCase(), l.id]));
71627
71649
  labelCache.set(t, map2);
71628
71650
  }
71629
- return map2.get(name.toLowerCase()) ?? null;
71651
+ const existing = map2.get(name.toLowerCase());
71652
+ if (existing)
71653
+ return existing;
71654
+ try {
71655
+ let teamId = teamIdCache.get(t);
71656
+ if (!teamId) {
71657
+ const fetched = await fetchTeamIdByKey(apiKey, t);
71658
+ if (!fetched)
71659
+ return null;
71660
+ teamId = fetched;
71661
+ teamIdCache.set(t, teamId);
71662
+ }
71663
+ const newId = await createIssueLabel(apiKey, teamId, name);
71664
+ if (!newId)
71665
+ return null;
71666
+ map2.set(name.toLowerCase(), newId);
71667
+ onLog(` created Linear label '${name}' for team ${t}`, "gray");
71668
+ return newId;
71669
+ } catch {
71670
+ return null;
71671
+ }
71630
71672
  }
71631
71673
  async function applyMarker(issue, m) {
71632
71674
  if (m.type === "status") {
@@ -71640,7 +71682,7 @@ function buildAgentCoordinator(input) {
71640
71682
  } else {
71641
71683
  const id = await resolveLabelId(issue, m.value);
71642
71684
  if (!id) {
71643
- onLog(`! Linear label '${m.value}' not found for ${issue.identifier}`, "yellow");
71685
+ onLog(`! Linear label '${m.value}' could not be created for ${issue.identifier}`, "yellow");
71644
71686
  return;
71645
71687
  }
71646
71688
  await addLabelToIssue(apiKey, issue.id, id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neriros/ralphy",
3
- "version": "2.13.11",
3
+ "version": "2.13.12",
4
4
  "description": "An iterative AI task execution framework. Orchestrates multi-phase autonomous work using Claude or Codex engines.",
5
5
  "keywords": [
6
6
  "agent",