pi-note 0.5.1 → 0.5.2

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 (3) hide show
  1. package/README.md +6 -3
  2. package/package.json +1 -1
  3. package/pr-watch.ts +25 -1
package/README.md CHANGED
@@ -133,9 +133,12 @@ Allowed intervals are 10–86400 seconds. The selected task's link remains visib
133
133
  Network/authentication failures warn once until recovery and retry next interval.
134
134
  No polling runs in print/RPC mode or after Pi exits.
135
135
 
136
- On merge, Pi waits until idle and asks **Mark this task completed?** Confirmation
137
- uses the same guarded CLI Done operation as `/pi-note`; declining leaves the task
138
- unchanged. If it is already done, Pi says **PR #123 was merged and the task is
136
+ On merge, Pi waits until idle and asks **Mark this task completed?** In Kitty,
137
+ indeterminate progress animates the tab while the prompt awaits input (with Kitty's
138
+ default progress-aware tab title or a working/ready renderer). Progress clears on
139
+ response, cancellation, or shutdown; other terminals and redirected output are untouched.
140
+ Confirmation uses the same guarded CLI Done operation as `/pi-note`; declining leaves
141
+ the task unchanged. If it is already done, Pi says **PR #123 was merged and the task is
139
142
  already completed**, without completing it again. Completion clears the selection
140
143
  and hides the footer link, even with polling disabled. The background watch remains
141
144
  until another task is selected, the link is removed, or Pi exits. Removed/scheduled tasks are no longer watched.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-note",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "Persistent pinote tasks, Markdown handoffs, and task status for Pi",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/pr-watch.ts CHANGED
@@ -32,6 +32,30 @@ const watchKey = (task: WatchedTask | null) => {
32
32
  return task && pr ? keyFor(task, pr) : undefined;
33
33
  };
34
34
 
35
+ async function confirmCompletion(ctx: ExtensionContext, pr: PR, signal: AbortSignal) {
36
+ let timer: ReturnType<typeof setInterval> | undefined;
37
+ const report = () => process.stdout.write("\x1b]9;4;3\x1b\\");
38
+ const stop = () => {
39
+ if (timer === undefined) return;
40
+ clearInterval(timer);
41
+ timer = undefined;
42
+ process.stdout.write("\x1b]9;4;0\x1b\\");
43
+ };
44
+ if (process.stdout.isTTY && process.env.KITTY_WINDOW_ID && !signal.aborted) {
45
+ report();
46
+ // Refresh Kitty's progress timeout and redraw the tab while input is pending.
47
+ timer = setInterval(report, 125);
48
+ timer.unref();
49
+ signal.addEventListener("abort", stop, { once: true });
50
+ }
51
+ try {
52
+ return await ctx.ui.confirm(`PR #${pr.number} was merged`, "Mark this task completed?", { signal });
53
+ } finally {
54
+ signal.removeEventListener("abort", stop);
55
+ stop();
56
+ }
57
+ }
58
+
35
59
  export function createPRWatcher(pi: ExtensionAPI, deps: Dependencies) {
36
60
  let ctx: ExtensionContext | undefined;
37
61
  let watched: WatchedTask | null = null;
@@ -129,7 +153,7 @@ export function createPRWatcher(pi: ExtensionAPI, deps: Dependencies) {
129
153
  };
130
154
  if (current.state === "done") { alreadyDone(); return; }
131
155
  if (!["active", "in_progress"].includes(current.state)) return;
132
- const confirmed = await context.ui.confirm(`PR #${pr.number} was merged`, "Mark this task completed?", { signal });
156
+ const confirmed = await confirmCompletion(context, pr, signal);
133
157
  if (!same() || !context.isIdle()) return;
134
158
  // Re-read selection, link, and revision after the dialog; never complete a changed task.
135
159
  const fresh = await latest(context, current);