pier-setup 0.2.5 → 0.2.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 +32 -5
- package/install.mjs +33 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,12 +90,39 @@ herdr plugin link ./packages/pier-workbench # development
|
|
|
90
90
|
|
|
91
91
|
The extension degrades gracefully outside a herdr environment (see Scope below).
|
|
92
92
|
|
|
93
|
-
### Scope (
|
|
93
|
+
### Scope (what the pi extension mutates)
|
|
94
|
+
|
|
95
|
+
`pi-pier` is not dormant outside herdr. After install it is live in every pi session:
|
|
96
|
+
|
|
97
|
+
| Surface | Bare `pi` | Inside herdr |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| `todo_write`, `/todos`, widget, anti-freeze, stop reminder | live | live |
|
|
100
|
+
| `ask_user_question` | live | live + blocked marker |
|
|
101
|
+
| Hidden inject (`before_agent_start` todo-read; settle reminder) | live | live |
|
|
102
|
+
| `subagent`, `terminal` | **not registered** | live |
|
|
103
|
+
| `/locks`, write-lock, slim-frame, pane title, pipe | off | live |
|
|
104
|
+
| `setActiveTools` role visible layer | off | on (herdr master) |
|
|
105
|
+
|
|
106
|
+
Session JSONL custom types (`pi-herdr.todo-edit`, `.subs`, `.terminals`, `.todo-read`, `.todo-reminder`, …) persist across `/resume` even without herdr.
|
|
107
|
+
|
|
108
|
+
### Plugin conflicts
|
|
109
|
+
|
|
110
|
+
pi overwrites tools/commands by name; event listeners stack. Two todo or subagent plugins will silently replace each other.
|
|
111
|
+
|
|
112
|
+
**Do not install alongside** (same-name overwrite → wrong handler, split JSONL):
|
|
113
|
+
|
|
114
|
+
- [`@nguyenquangthai/pi-todo`](https://pi.dev/packages/@nguyenquangthai/pi-todo) — `todo_write` + overlay
|
|
115
|
+
- [`@josephyoung/pi-ask-user-question`](https://pi.dev/packages/@josephyoung/pi-ask-user-question) — `ask_user_question`
|
|
116
|
+
- [`pi-herdr-subagents`](https://pi.dev/packages/pi-herdr-subagents) — `subagent` + herdr panes
|
|
117
|
+
|
|
118
|
+
**Soft conflict** (two orchestrators / two injectors — the agent “talks to itself”):
|
|
119
|
+
|
|
120
|
+
- [`@tintinweb/pi-subagents`](https://pi.dev/packages/@tintinweb/pi-subagents) (`Agent`)
|
|
121
|
+
- [`@minhduydev/pi-subagents`](https://pi.dev/packages/@minhduydev/pi-subagents) (`task`)
|
|
122
|
+
- any other extension that calls `setActiveTools`, `ui.custom` overlay, `before_agent_start`, or `sendUserMessage`/`sendMessage` followUp
|
|
123
|
+
|
|
124
|
+
**Designed coexistence:** herdr’s official `herdr:pi` reporter. Keep it. pier emits `herdr:blocked` so that plugin remains lifecycle authority.
|
|
94
125
|
|
|
95
|
-
- **pi outside herdr**: the extension degrades — reporting is free, workbench tools
|
|
96
|
-
(`subagent`, terminal family) return a clear "requires a herdr-managed pane" error;
|
|
97
|
-
`todo_write` / `ask_user_question` stay available (session JSONL is the authority,
|
|
98
|
-
no herdr dependency).
|
|
99
126
|
- **other agents inside herdr (claude code / codex etc.)**: tabs without a pi pane
|
|
100
127
|
are excluded from heat reflow; blocked notifications are pi-only; master-tab
|
|
101
128
|
auto-bootstrap can be disabled with `autoBootstrap: false` in boot-config.
|
package/install.mjs
CHANGED
|
@@ -86,8 +86,17 @@ function which(bin) {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
function run(cmd, args) {
|
|
90
|
-
|
|
89
|
+
function run(cmd, args, opts = {}) {
|
|
90
|
+
// win32: npm 全局 bin 是 .cmd shim,无 shell 直接 spawn 会 ENOENT/EINVAL,须走 cmd.exe;
|
|
91
|
+
// 且 shell:true 时 Node 把 args 按空格裸拼接(不加引号),含空格的路径参数会被拆碎,故预拼接并加引号。
|
|
92
|
+
// POSIX 走原生分支,保持 execFileSync(cmd, args) 原语义。
|
|
93
|
+
if (IS_WIN) {
|
|
94
|
+
const cmdline = [cmd, ...args]
|
|
95
|
+
.map((a) => (/[\s"]/.test(a) ? `"${a.replace(/"/g, '\\"')}"` : a))
|
|
96
|
+
.join(' ');
|
|
97
|
+
return execFileSync(cmdline, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], shell: true, ...opts }).trim();
|
|
98
|
+
}
|
|
99
|
+
return execFileSync(cmd, args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], ...opts }).trim();
|
|
91
100
|
}
|
|
92
101
|
|
|
93
102
|
function tryRun(cmd, args) {
|
|
@@ -126,9 +135,7 @@ function readPkgVersion(dir) {
|
|
|
126
135
|
|
|
127
136
|
function npmLatest(name) {
|
|
128
137
|
try {
|
|
129
|
-
return
|
|
130
|
-
encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 15000,
|
|
131
|
-
}).trim();
|
|
138
|
+
return run('npm', ['view', name, 'version'], { timeout: 15000 });
|
|
132
139
|
} catch {
|
|
133
140
|
return null;
|
|
134
141
|
}
|
|
@@ -185,6 +192,25 @@ function piAgentDir() {
|
|
|
185
192
|
return process.env.PI_CODING_AGENT_DIR || join(homedir(), '.pi', 'agent');
|
|
186
193
|
}
|
|
187
194
|
|
|
195
|
+
/* ── 旧版 git 模式注册迁移 ──────────────────────────────────────── */
|
|
196
|
+
// 早期 `pi install git:github.com/July24/pier` 的遗留注册与 npm:pi-pier 并存时,
|
|
197
|
+
// 两份扩展会注册同名工具(todo_write / ask_user_question…),pi 启动即报 conflict。
|
|
198
|
+
const LEGACY_GIT_SPEC = 'git:github.com/July24/pier';
|
|
199
|
+
|
|
200
|
+
function registeredPiPackages() {
|
|
201
|
+
try {
|
|
202
|
+
return JSON.parse(readFileSync(join(piAgentDir(), 'settings.json'), 'utf8'))?.packages ?? [];
|
|
203
|
+
} catch { return []; }
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** install/update 前清理旧 git 模式注册;--pi-spec 显式指定该 git 源时视为目标源,不动。 */
|
|
207
|
+
function removeLegacyGitRegistration() {
|
|
208
|
+
if (piSource() === LEGACY_GIT_SPEC) return;
|
|
209
|
+
if (!registeredPiPackages().includes(LEGACY_GIT_SPEC)) return;
|
|
210
|
+
if (tryRun('pi', ['remove', LEGACY_GIT_SPEC])) log(`✓ removed legacy git-mode registration (${LEGACY_GIT_SPEC}); using ${piSource()}`);
|
|
211
|
+
else { console.error('✗ failed to remove legacy git-mode registration'); log(` manual: pi remove ${LEGACY_GIT_SPEC}`); process.exitCode = 1; }
|
|
212
|
+
}
|
|
213
|
+
|
|
188
214
|
function npmNameFromSpec(spec) {
|
|
189
215
|
if (!spec.startsWith('npm:')) return null;
|
|
190
216
|
const rest = spec.slice(4);
|
|
@@ -358,6 +384,7 @@ function version() {
|
|
|
358
384
|
|
|
359
385
|
function update() {
|
|
360
386
|
checkEnv();
|
|
387
|
+
removeLegacyGitRegistration();
|
|
361
388
|
const me = readPkgVersion(ROOT);
|
|
362
389
|
const latestSetup = npmLatest('pier-setup');
|
|
363
390
|
if (latestSetup && me && cmpSemver(me, latestSetup) < 0) {
|
|
@@ -383,6 +410,7 @@ function install() {
|
|
|
383
410
|
const hmrDev = flags.has('--hmr-dev');
|
|
384
411
|
const force = flags.has('--force');
|
|
385
412
|
checkEnv();
|
|
413
|
+
removeLegacyGitRegistration();
|
|
386
414
|
|
|
387
415
|
if (dev) {
|
|
388
416
|
if (tryRun('pi', ['install', piSource()])) log('✓ pi extension installed (packages/pier-ext, local)');
|