@henryqw/pi-pr 3.1.1 → 3.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/README.md +4 -2
- package/extensions/pr-command.ts +12 -5
- package/extensions/pr.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,11 +34,13 @@ write files.
|
|
|
34
34
|
|
|
35
35
|
## Use
|
|
36
36
|
|
|
37
|
-
Run `/pr`
|
|
37
|
+
Run `/pr` in a GitHub checkout. It reads the current branch pull request and local state, then runs one route. The PR hostname selects its GitHub API host, and the extension works outside Herdr.
|
|
38
|
+
|
|
39
|
+
Add optional instructions to guide a creation, branch-update, CI-fix, or feedback workflow. For example, run `/pr keep the title under 50 characters`. Direct routes, such as linking or merging, reject instructions instead of ignoring them.
|
|
38
40
|
|
|
39
41
|
| Surface | Type | Purpose |
|
|
40
42
|
| --- | --- | --- |
|
|
41
|
-
| `/pr` | command | Run the current pull request's next safe route. |
|
|
43
|
+
| `/pr [instructions]` | command | Run the current pull request's next safe route. |
|
|
42
44
|
| Footer | ui | Show a linked `PR #number` and one plain-language status. |
|
|
43
45
|
| Widget | ui | Show one actionable icon-prefixed `Run /pr to …` hint. |
|
|
44
46
|
|
package/extensions/pr-command.ts
CHANGED
|
@@ -34,7 +34,12 @@ type PrCommandDependencies = {
|
|
|
34
34
|
linkInferredPullRequest?: typeof linkInferredPullRequest;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
function dispatchWorkflow(
|
|
37
|
+
function dispatchWorkflow(
|
|
38
|
+
pi: PrCommandPi,
|
|
39
|
+
ctx: ExtensionCommandContext,
|
|
40
|
+
commandName: string,
|
|
41
|
+
instructions: string,
|
|
42
|
+
): void {
|
|
38
43
|
const command = pi.getCommands().find((candidate) =>
|
|
39
44
|
candidate.name === commandName &&
|
|
40
45
|
candidate.source === "skill" &&
|
|
@@ -45,7 +50,7 @@ function dispatchWorkflow(pi: PrCommandPi, ctx: ExtensionCommandContext, command
|
|
|
45
50
|
const options = ctx.isIdle()
|
|
46
51
|
? { expandPromptTemplates: true }
|
|
47
52
|
: { deliverAs: "followUp" as const, expandPromptTemplates: true };
|
|
48
|
-
pi.sendUserMessage(`/${command.name}`, options);
|
|
53
|
+
pi.sendUserMessage(`/${command.name}${instructions ? ` ${instructions}` : ""}`, options);
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
function noActionNotification(pullRequest: CurrentPullRequest): { message: string; type: "info" | "warning" } {
|
|
@@ -171,10 +176,12 @@ export function createPrCommandHandler(
|
|
|
171
176
|
const load = dependencies.loadCurrentPullRequest ?? loadCurrentPullRequest;
|
|
172
177
|
const link = dependencies.linkInferredPullRequest ?? linkInferredPullRequest;
|
|
173
178
|
return async (args, ctx) => {
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
const instructions = args.trim();
|
|
176
180
|
const discovery = await load(pi, ctx);
|
|
177
181
|
const nextStep = deriveNextStep(discovery);
|
|
182
|
+
if (instructions && !(nextStep in WORKFLOWS)) {
|
|
183
|
+
throw new Error("The current /pr route does not accept instructions");
|
|
184
|
+
}
|
|
178
185
|
if (discovery.kind === "inactive") return nextStep;
|
|
179
186
|
if (discovery.kind === "blocked") {
|
|
180
187
|
return nextStep;
|
|
@@ -197,7 +204,7 @@ export function createPrCommandHandler(
|
|
|
197
204
|
}
|
|
198
205
|
|
|
199
206
|
if (!(nextStep in WORKFLOWS)) throw new Error(`/pr cannot dispatch route ${nextStep}`);
|
|
200
|
-
dispatchWorkflow(pi, ctx, WORKFLOWS[nextStep as WorkflowNextStep]);
|
|
207
|
+
dispatchWorkflow(pi, ctx, WORKFLOWS[nextStep as WorkflowNextStep], instructions);
|
|
201
208
|
return nextStep;
|
|
202
209
|
};
|
|
203
210
|
}
|
package/extensions/pr.ts
CHANGED
|
@@ -320,7 +320,7 @@ export default function pullRequestExtension(
|
|
|
320
320
|
|
|
321
321
|
const commandHandler = createCommandHandler(pi);
|
|
322
322
|
pi.registerCommand("pr", {
|
|
323
|
-
description: "Run the current branch pull request next step",
|
|
323
|
+
description: "[instructions] — Run the current branch pull request next step",
|
|
324
324
|
handler: async (args, ctx) => {
|
|
325
325
|
if (!ctx.hasUI || !context) return;
|
|
326
326
|
const generation = sessionGeneration;
|
package/package.json
CHANGED