@pi-stef/pair 0.1.1 → 0.1.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/package.json +1 -1
- package/src/register.ts +44 -8
package/package.json
CHANGED
package/src/register.ts
CHANGED
|
@@ -215,17 +215,53 @@ export function registerSfPair(pi: ExtensionAPI): void {
|
|
|
215
215
|
});
|
|
216
216
|
|
|
217
217
|
// Register slash commands
|
|
218
|
+
const send = typeof pi.sendUserMessage === "function" ? pi.sendUserMessage.bind(pi) : undefined;
|
|
219
|
+
|
|
220
|
+
const slashDescriptions: Record<string, string> = {
|
|
221
|
+
sf_pair_plan: "Create implementation plan with reviewer loop. Args: task description",
|
|
222
|
+
sf_pair_implement: "Execute plan in worktree with milestone reviews. Args: plan folder path or slug",
|
|
223
|
+
sf_pair_task: "Execute single task end-to-end. Args: task description",
|
|
224
|
+
};
|
|
225
|
+
|
|
218
226
|
for (const name of PAIR_TOOL_NAMES) {
|
|
219
227
|
const slashName = name.replace(/_/g, "-");
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
sf_pair_implement: "Execute plan in worktree with milestone reviews",
|
|
223
|
-
sf_pair_task: "Execute single task end-to-end",
|
|
224
|
-
};
|
|
228
|
+
const desc = slashDescriptions[name] ?? name;
|
|
229
|
+
|
|
225
230
|
pi.registerCommand(slashName, {
|
|
226
|
-
description:
|
|
227
|
-
handler: async (
|
|
228
|
-
|
|
231
|
+
description: desc,
|
|
232
|
+
handler: async (args, ctx) => {
|
|
233
|
+
const trimmed = args.trim();
|
|
234
|
+
let message: string;
|
|
235
|
+
|
|
236
|
+
if (name === "sf_pair_plan") {
|
|
237
|
+
message = trimmed.length === 0
|
|
238
|
+
? "Invoke the sf_pair_plan tool. Ask me first what to plan."
|
|
239
|
+
: `Invoke the sf_pair_plan tool with prompt: ${trimmed}`;
|
|
240
|
+
} else if (name === "sf_pair_implement") {
|
|
241
|
+
message = trimmed.length === 0
|
|
242
|
+
? "Invoke the sf_pair_implement tool. Ask me first for the plan folder path or slug."
|
|
243
|
+
: `Invoke the sf_pair_implement tool with path: ${trimmed}`;
|
|
244
|
+
} else {
|
|
245
|
+
// sf_pair_task
|
|
246
|
+
message = trimmed.length === 0
|
|
247
|
+
? "Invoke the sf_pair_task tool. Ask me first what task to execute."
|
|
248
|
+
: `Invoke the sf_pair_task tool with prompt: ${trimmed}`;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (!send) {
|
|
252
|
+
ctx.ui?.notify?.(
|
|
253
|
+
`pair: this pi runtime can't post slash-command output to the agent. Type "${slashName} ${trimmed}" instead.`,
|
|
254
|
+
"warning",
|
|
255
|
+
);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const idle = typeof ctx.isIdle === "function" ? ctx.isIdle() : true;
|
|
260
|
+
if (idle) {
|
|
261
|
+
send(message);
|
|
262
|
+
} else {
|
|
263
|
+
send(message, { deliverAs: "followUp" });
|
|
264
|
+
}
|
|
229
265
|
},
|
|
230
266
|
});
|
|
231
267
|
}
|