@neriros/ralphy 2.13.11 → 2.13.13

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 +52 -7
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -70507,13 +70507,37 @@ async function updateIssueState(apiKey, issueId, stateId) {
70507
70507
  async function fetchIssueLabels(apiKey, teamKey) {
70508
70508
  const query = `query Labels($team: String!) {
70509
70509
  issueLabels(filter: { team: { key: { eq: $team } } }, first: 250) {
70510
- nodes { id name }
70510
+ nodes { id name parent { name } }
70511
70511
  }
70512
70512
  }`;
70513
70513
  const data = await linearRequest(apiKey, query, {
70514
70514
  team: teamKey
70515
70515
  });
70516
- return data.issueLabels.nodes;
70516
+ return data.issueLabels.nodes.map((l) => ({
70517
+ id: l.id,
70518
+ name: l.parent ? `${l.parent.name}:${l.name}` : l.name
70519
+ }));
70520
+ }
70521
+ async function fetchTeamIdByKey(apiKey, teamKey) {
70522
+ const query = `query TeamId($key: String!) {
70523
+ teams(filter: { key: { eq: $key } }, first: 1) {
70524
+ nodes { id }
70525
+ }
70526
+ }`;
70527
+ const data = await linearRequest(apiKey, query, {
70528
+ key: teamKey
70529
+ });
70530
+ return data.teams.nodes[0]?.id ?? null;
70531
+ }
70532
+ async function createIssueLabel(apiKey, teamId, name) {
70533
+ const mutation = `mutation CreateLabel($teamId: String!, $name: String!) {
70534
+ issueLabelCreate(input: { teamId: $teamId, name: $name }) {
70535
+ success
70536
+ issueLabel { id }
70537
+ }
70538
+ }`;
70539
+ const data = await linearRequest(apiKey, mutation, { teamId, name });
70540
+ return data.issueLabelCreate.issueLabel?.id ?? null;
70517
70541
  }
70518
70542
  async function addLabelToIssue(apiKey, issueId, labelId) {
70519
70543
  const mutation = `mutation AddLabel($id: String!, $labelId: String!) {
@@ -71404,9 +71428,9 @@ ${reBlob.trim()}`);
71404
71428
  continue;
71405
71429
  }
71406
71430
  }
71407
- if (!isHookReject || hookFixAttempt >= maxHookFixAttempts) {
71431
+ if (!pushRejected || hookFixAttempt >= maxHookFixAttempts) {
71408
71432
  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");
71433
+ log2(`! push rejected for ${changeName} after ${hookFixAttempt} fix attempts (push still failing) \u2014 worktree preserved at ${cwd2}`, "red");
71410
71434
  log2(` detail: ${detail}`, "red");
71411
71435
  } else {
71412
71436
  log2(`! PR create failed for ${changeName}: ${detail}`, "red");
@@ -71419,7 +71443,7 @@ ${reBlob.trim()}`);
71419
71443
  emit("push-retry", `${hookFixAttempt}/${maxHookFixAttempts}`);
71420
71444
  log2(`! push rejected for ${changeName} \u2014 prepending fix task and re-running loop (attempt ${hookFixAttempt}/${maxHookFixAttempts})`, "yellow");
71421
71445
  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.
71446
+ 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
71447
 
71424
71448
  ` + combined.trim());
71425
71449
  if (retryCode !== 0) {
@@ -71607,6 +71631,7 @@ function buildAgentCoordinator(input) {
71607
71631
  const cmdRunner = input.runners?.cmd ?? bunCmdRunner;
71608
71632
  const stateCache = new Map;
71609
71633
  const labelCache = new Map;
71634
+ const teamIdCache = new Map;
71610
71635
  const teamKeyOf = (issue) => issue.identifier.split("-")[0];
71611
71636
  async function resolveStateId(issue, name) {
71612
71637
  const t = teamKeyOf(issue);
@@ -71626,7 +71651,27 @@ function buildAgentCoordinator(input) {
71626
71651
  map2 = new Map(labels.map((l) => [l.name.toLowerCase(), l.id]));
71627
71652
  labelCache.set(t, map2);
71628
71653
  }
71629
- return map2.get(name.toLowerCase()) ?? null;
71654
+ const existing = map2.get(name.toLowerCase());
71655
+ if (existing)
71656
+ return existing;
71657
+ try {
71658
+ let teamId = teamIdCache.get(t);
71659
+ if (!teamId) {
71660
+ const fetched = await fetchTeamIdByKey(apiKey, t);
71661
+ if (!fetched)
71662
+ return null;
71663
+ teamId = fetched;
71664
+ teamIdCache.set(t, teamId);
71665
+ }
71666
+ const newId = await createIssueLabel(apiKey, teamId, name);
71667
+ if (!newId)
71668
+ return null;
71669
+ map2.set(name.toLowerCase(), newId);
71670
+ onLog(` created Linear label '${name}' for team ${t}`, "gray");
71671
+ return newId;
71672
+ } catch {
71673
+ return null;
71674
+ }
71630
71675
  }
71631
71676
  async function applyMarker(issue, m) {
71632
71677
  if (m.type === "status") {
@@ -71640,7 +71685,7 @@ function buildAgentCoordinator(input) {
71640
71685
  } else {
71641
71686
  const id = await resolveLabelId(issue, m.value);
71642
71687
  if (!id) {
71643
- onLog(`! Linear label '${m.value}' not found for ${issue.identifier}`, "yellow");
71688
+ onLog(`! Linear label '${m.value}' could not be created for ${issue.identifier}`, "yellow");
71644
71689
  return;
71645
71690
  }
71646
71691
  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.13",
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",