@henryqw/pi-pr 6.0.6 → 6.0.7

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/README.md CHANGED
@@ -141,9 +141,9 @@ The sweep runs existing non-destructive checks on the clean committed `HEAD` bef
141
141
 
142
142
  ### Refresh
143
143
 
144
- The footer and widget load once at session start. A directory outside a Git worktree stays silent. The UI shows `PR · status unavailable` for other discovery failures and reports only a generic error.
144
+ PR discovery starts in the background at session start, so the Pi footer appears before the PR status is ready. When switching sessions, the previous PR status and action hint clear immediately; the new ones appear when discovery finishes. A directory outside a Git worktree stays silent. The UI shows `PR · status unavailable` for other discovery failures and reports only a generic error.
145
145
 
146
- They refresh after local commits, PR creation, pushes, and each dispatched workflow settles. During creation, intermediate refreshes wait until the workflow settles. They also refresh after any successful delegated task settles. There is no periodic presentation refresh, so external changes may leave the footer and widget stale indefinitely. `/pr` reads fresh state before routing or acting and remains authoritative.
146
+ They refresh after local commits, PR creation, pushes, and each dispatched workflow settles. During creation, intermediate refreshes wait until the workflow settles. They also refresh after any successful delegated task settles. There is no periodic presentation refresh, so external changes may leave the footer and widget stale indefinitely. `/pr` cancels any pending presentation lookup and reads fresh state before routing or acting; it remains authoritative.
147
147
 
148
148
  The create widget stays hidden on a clean branch with no commit ahead. It appears for a commit ahead or ordinary pending work. It stays hidden during a Git operation and when the current branch is the selected base. `/pr` replaces any hint with routing feedback while it selects a route. The feedback clears before route interaction. A dispatched workflow keeps the widget hidden until the agent settles. Direct and no-action routes refresh it after completion. A failed command restores the prior hint and schedules a refresh, except when fresh lookup hits the GitHub API quota: it shows the sanitized message `GitHub API rate limit exhausted; retry after GitHub resets it` and does not immediately retry.
149
149
 
@@ -1240,18 +1240,19 @@ async function readRemoteAuthority(
1240
1240
  if (urls.length !== 1) fail(action, `multiple ${kind} URLs are configured`);
1241
1241
  return parseRemoteUrl(urls[0], kind);
1242
1242
  };
1243
- const readRepository = async (remoteUrl: PushUrl, kind: "push" | "fetch"): Promise<PushRepository> => {
1244
- const action = `Read ${kind} repository`;
1245
- const result = await execute(pi, context, action, "gh", [
1243
+ const readRepository = async (remoteUrl: PushUrl, kind: "push" | "fetch"): Promise<string> => {
1244
+ const result = await execute(pi, context, `Read ${kind} repository`, "gh", [
1246
1245
  "repo", "view", remoteUrl.locator, "--json", "nameWithOwner,url",
1247
1246
  ]);
1248
- return parseRemoteRepository(result.stdout, remoteUrl, kind);
1247
+ return result.stdout;
1249
1248
  };
1250
1249
 
1251
1250
  const pushUrl = await readUrl("push");
1252
- const pushRepository = await readRepository(pushUrl, "push");
1251
+ const pushOutput = await readRepository(pushUrl, "push");
1252
+ const pushRepository = parseRemoteRepository(pushOutput, pushUrl, "push");
1253
1253
  const fetchUrl = await readUrl("fetch");
1254
- const fetchRepository = await readRepository(fetchUrl, "fetch");
1254
+ const fetchOutput = fetchUrl.locator === pushUrl.locator ? pushOutput : await readRepository(fetchUrl, "fetch");
1255
+ const fetchRepository = parseRemoteRepository(fetchOutput, fetchUrl, "fetch");
1255
1256
  if (
1256
1257
  fetchRepository.host !== pushRepository.host ||
1257
1258
  fetchRepository.normalizedName !== pushRepository.normalizedName
package/extensions/pr.ts CHANGED
@@ -717,12 +717,14 @@ export default function pullRequestExtension(
717
717
  }
718
718
  });
719
719
 
720
- pi.on("session_start", async (_event, ctx) => {
720
+ pi.on("session_start", (_event, ctx) => {
721
721
  stop();
722
722
  observation = latestObservation(ctx);
723
723
  if (!ctx.hasUI) return;
724
724
  context = ctx;
725
- await refresh();
725
+ ctx.ui.setStatus(UI_KEY, undefined);
726
+ ctx.ui.setWidget(UI_KEY, undefined);
727
+ refreshInBackground();
726
728
  });
727
729
 
728
730
  pi.on("session_shutdown", stop);
@@ -779,6 +781,7 @@ export default function pullRequestExtension(
779
781
  description: "[--feedback | --base <branch> [instructions]] — Run the current branch pull request next step",
780
782
  handler: async (args, ctx) => {
781
783
  if (!ctx.hasUI || !context) return;
784
+ cancelRefresh();
782
785
  const generation = sessionGeneration;
783
786
  const invocation = ++commandGeneration;
784
787
  activeInvocations.set(invocation, "routing");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-pr",
3
- "version": "6.0.6",
3
+ "version": "6.0.7",
4
4
  "description": "Run /pr to safely discover or link the current pull request, then create, update, address feedback, fix CI, or merge when ready.",
5
5
  "keywords": [
6
6
  "pi-package",