pi-note 0.33.1 → 0.33.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.
- package/README.md +3 -2
- package/package.json +1 -1
- package/remote/exit.ts +7 -1
package/README.md
CHANGED
|
@@ -96,8 +96,9 @@ Pi's working directory before exiting, so Kitty closes its dedicated tab (or the
|
|
|
96
96
|
standalone window's last tab). It never merges, rebases or stashes local changes.
|
|
97
97
|
If Git fails, times out (30 seconds), or the session/draft changes, Pi stays open;
|
|
98
98
|
the task remains completed and is not retried. Check Git manually, then `/quit`.
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
With pi-note 0.33.2+, directories outside a Git repository skip the pull and exit
|
|
100
|
+
normally. Branches without an upstream still stay open after a failed pull.
|
|
101
|
+
`/quit` and Exit without completing do not pull.
|
|
101
102
|
This ownership survives `/reload`, but not `/new`, resume, fork, tree navigation
|
|
102
103
|
or process restart. Completing a different task or an externally completed task
|
|
103
104
|
does not pull or close Pi; failed/uncertain completion stays open.
|
package/package.json
CHANGED
package/remote/exit.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
1
2
|
import { CustomEditor, type ExtensionAPI, type ExtensionContext } from '@earendil-works/pi-coding-agent';
|
|
2
3
|
import { truncateToWidth } from '@earendil-works/pi-tui';
|
|
3
4
|
import { clean } from './protocol.ts';
|
|
@@ -10,8 +11,13 @@ export async function pullBeforeExit(pi: ExtensionAPI, ctx: ExtensionContext, si
|
|
|
10
11
|
const unchanged = () => current() && !signal.aborted && ctx.isIdle() &&
|
|
11
12
|
ctx.sessionManager.getSessionId() === sessionId && ctx.sessionManager.getLeafId() === branch && ctx.ui.getEditorText() === draft;
|
|
12
13
|
if (!unchanged()) return false;
|
|
13
|
-
ctx.ui.notify('Task completed. Running git pull --ff-only before closing Pi…', 'info');
|
|
14
14
|
try {
|
|
15
|
+
const repository = spawnSync('git', ['rev-parse', '--show-toplevel'], {
|
|
16
|
+
cwd: ctx.cwd, encoding: 'utf8', timeout: 3000, env: { ...process.env, LC_ALL: 'C' },
|
|
17
|
+
});
|
|
18
|
+
if (!repository.error && repository.status === 128 && repository.stderr.startsWith('fatal: not a git repository (or any ')) return unchanged();
|
|
19
|
+
if (repository.error || repository.status !== 0 || !unchanged()) throw new Error('Git repository check failed');
|
|
20
|
+
ctx.ui.notify('Task completed. Running git pull --ff-only before closing Pi…', 'info');
|
|
15
21
|
const result = await pi.exec('git', ['pull', '--ff-only', '--no-rebase', '--no-autostash'], { cwd: ctx.cwd, signal, timeout: 30_000 });
|
|
16
22
|
if (result.code === 0 && !result.killed && unchanged()) return true;
|
|
17
23
|
} catch { /* Completion succeeded; only the local pull failed. */ }
|