@henryqw/pi-pr 3.1.1 → 3.1.3

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 CHANGED
@@ -21,10 +21,13 @@ keeps the complete JSON output. Read one item with
21
21
  `pr-feedback.mjs show --snapshot FILE --id ID`.
22
22
 
23
23
  `show` prints one JSON record with its exact stored body and fields. A thread
24
- record includes child IDs without child bodies. A nested comment includes only
25
- its parent thread's ID, state, and location. Missing, unknown, duplicate, or
26
- ambiguous IDs fail. `show` does not run Git, call GitHub, use the network, or
27
- write files.
24
+ record includes child IDs without child bodies. Treat that record as a container.
25
+ Inspect the `thread_comment` IDs directly. Do not call `show` on the parent only
26
+ to find children. Show the parent only when it has no child, or when you need
27
+ parent-level metadata. Issue independent `show` lookups in one tool-call round.
28
+ A nested comment includes only its parent thread's ID, state, and location.
29
+ Missing, unknown, duplicate, or ambiguous IDs fail. `show` does not run Git, call
30
+ GitHub, use the network, or write files.
28
31
 
29
32
  ## Works with
30
33
 
@@ -34,11 +37,13 @@ write files.
34
37
 
35
38
  ## Use
36
39
 
37
- Run `/pr` without arguments 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.
40
+ 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.
41
+
42
+ 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
43
 
39
44
  | Surface | Type | Purpose |
40
45
  | --- | --- | --- |
41
- | `/pr` | command | Run the current pull request's next safe route. |
46
+ | `/pr [instructions]` | command | Run the current pull request's next safe route. |
42
47
  | Footer | ui | Show a linked `PR #number` and one plain-language status. |
43
48
  | Widget | ui | Show one actionable icon-prefixed `Run /pr to …` hint. |
44
49
 
@@ -104,7 +109,7 @@ The comment sweep resolves its bundled helper and references from the installed
104
109
 
105
110
  The footer and widget load at session start. A directory outside a Git worktree stays silent and does not start polling. The UI shows `PR · status unavailable` for other discovery failures and reports only a generic error.
106
111
 
107
- They refresh after local commits, PR creation, pushes, and each dispatched workflow settles. They also refresh after any successful delegated task settles. Active Git worktrees poll every 30 seconds. Polling updates presentation only and may be stale.
112
+ They refresh after local commits, PR creation, pushes, and each dispatched workflow settles. During creation, intermediate refreshes wait until the workflow settles. They also refresh after any successful delegated task settles. Active Git worktrees poll every 30 seconds. Polling updates presentation only and may be stale.
108
113
 
109
114
  The create widget stays hidden until the local branch has a commit beyond its creation point. Any displayed widget clears as soon as `/pr` starts. A dispatched workflow keeps it hidden until the agent settles. A direct merge, no-action route, or failed command refreshes the widget when the handler finishes.
110
115
 
@@ -34,7 +34,12 @@ type PrCommandDependencies = {
34
34
  linkInferredPullRequest?: typeof linkInferredPullRequest;
35
35
  };
36
36
 
37
- function dispatchWorkflow(pi: PrCommandPi, ctx: ExtensionCommandContext, commandName: string): void {
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
- if (args.trim()) throw new Error("/pr does not accept arguments");
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
@@ -203,7 +203,7 @@ export default function pullRequestExtension(
203
203
 
204
204
  const refresh = async (): Promise<void> => {
205
205
  const ctx = context;
206
- if (!ctx) return;
206
+ if (!ctx || [...activeInvocations.values()].includes("create-workflow")) return;
207
207
  const generation = sessionGeneration;
208
208
  if (active) {
209
209
  queued = true;
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-pr",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "description": "Run /pr to safely discover or link the current pull request, then create, update, address feedback, fix CI, or merge when ready.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -33,13 +33,17 @@ Run standalone; never invoke, defer to, or modify Shipyard.
33
33
 
34
34
  2. Initial fetch prints a compact index of every feedback ID. Later fetches into
35
35
  a copied snapshot print compact indexes of additions, edits, and state changes.
36
- The snapshot remains complete. For each non-obvious item, inspect only that item:
36
+ The snapshot remains complete. A thread record with child IDs is a container:
37
+ inspect `thread_comment` IDs directly. Do not call `show` on the parent solely
38
+ to discover its children. Show the parent only if it has no child or parent-level
39
+ metadata is actually needed. For each non-obvious item, inspect only that item:
37
40
 
38
41
  ```bash
39
42
  node "<skill>/scripts/pr-feedback.mjs" show --snapshot "$SNAPSHOT" --id "$ID"
40
43
  ```
41
44
 
42
- Always inspect every unresolved feedback item before triage. Never
45
+ Issue independent `show` lookups in one tool-call round. Always inspect every
46
+ unresolved feedback item before triage. Never
43
47
  read or print the whole raw snapshot when `show` provides the bounded lookup.
44
48
  Follow [Thread triage](<skill>/references/thread-triage.md>) and ledger every item as
45
49
  `actionable`, `non-actionable`, or `blocked`, with terse evidence, smallest