prq-cli 0.5.0 → 0.6.0
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/dist/bin/prq.js +119 -0
- package/package.json +1 -1
package/dist/bin/prq.js
CHANGED
|
@@ -6478,6 +6478,122 @@ Available actions: ${available}`);
|
|
|
6478
6478
|
await executeCommand(command);
|
|
6479
6479
|
}
|
|
6480
6480
|
|
|
6481
|
+
// src/commands/skill.ts
|
|
6482
|
+
var SKILL_CONTENT = `---
|
|
6483
|
+
name: prq
|
|
6484
|
+
description: PR review queue manager. Use when the user wants to check their PR review queue, review PRs, nudge stale PRs, or manage code review workflow. Triggers on mentions of "review queue", "PRs waiting", "stale PRs", "what needs review", or "prq".
|
|
6485
|
+
---
|
|
6486
|
+
|
|
6487
|
+
# PRQ — PR Review Queue
|
|
6488
|
+
|
|
6489
|
+
You have access to the \`prq\` CLI tool installed on this machine. Use it to help the user manage their code review queue.
|
|
6490
|
+
|
|
6491
|
+
## Step 1: Get the queue
|
|
6492
|
+
|
|
6493
|
+
Run this command to get the user's current review queue:
|
|
6494
|
+
|
|
6495
|
+
\`\`\`bash
|
|
6496
|
+
prq status --json
|
|
6497
|
+
\`\`\`
|
|
6498
|
+
|
|
6499
|
+
This returns a JSON object with categorized PRs:
|
|
6500
|
+
- **needs-re-review** — PRs where the user left a review but new commits were pushed after
|
|
6501
|
+
- **requested** — PRs where the user is a requested reviewer
|
|
6502
|
+
- **stale** — PRs with no activity for N days
|
|
6503
|
+
- **waiting-on-others** — PRs the user authored that are waiting on someone else
|
|
6504
|
+
|
|
6505
|
+
## Step 2: Present the queue
|
|
6506
|
+
|
|
6507
|
+
Show the results in a clear, scannable format grouped by category. For each PR, show:
|
|
6508
|
+
- The category symbol (◆ needs re-review, ● requested, ○ stale, ◇ waiting)
|
|
6509
|
+
- The repo and PR number
|
|
6510
|
+
- The title
|
|
6511
|
+
- The detail (e.g., "new commits since your review 2d ago")
|
|
6512
|
+
|
|
6513
|
+
Then ask what the user wants to do.
|
|
6514
|
+
|
|
6515
|
+
## Step 3: Act on PRs
|
|
6516
|
+
|
|
6517
|
+
When the user asks to act on a PR, check the \`.prqrc.json\` file in the current directory (or \`~/.config/prq/config.json\`) for custom actions:
|
|
6518
|
+
|
|
6519
|
+
\`\`\`json
|
|
6520
|
+
{
|
|
6521
|
+
"actions": {
|
|
6522
|
+
"review": "/review {url}",
|
|
6523
|
+
"nudge": "shell:prq nudge {number} --yes"
|
|
6524
|
+
}
|
|
6525
|
+
}
|
|
6526
|
+
\`\`\`
|
|
6527
|
+
|
|
6528
|
+
### Action resolution
|
|
6529
|
+
|
|
6530
|
+
For each action template:
|
|
6531
|
+
- **Starts with \`/\`** — it's a Claude Code skill. Invoke it by running the skill with the interpolated value. For example, \`/review https://github.com/org/repo/pull/123\`
|
|
6532
|
+
- **Starts with \`shell:\`** — it's a shell command. Run it with the Bash tool. For example, \`prq nudge 123 --yes\`
|
|
6533
|
+
- **Otherwise** — treat it as a prompt. Send it as a message.
|
|
6534
|
+
|
|
6535
|
+
### Template variables
|
|
6536
|
+
|
|
6537
|
+
Replace these in the action template:
|
|
6538
|
+
- \`{url}\` — full PR URL
|
|
6539
|
+
- \`{number}\` — PR number
|
|
6540
|
+
- \`{owner}\` — repo owner
|
|
6541
|
+
- \`{repo}\` — repo name
|
|
6542
|
+
- \`{title}\` — PR title
|
|
6543
|
+
- \`{author}\` — PR author
|
|
6544
|
+
|
|
6545
|
+
### Default actions (if no config found)
|
|
6546
|
+
|
|
6547
|
+
If no actions are configured, use these defaults:
|
|
6548
|
+
- **review** — invoke \`/review {url}\` if the /review skill exists, otherwise run \`prq review {number}\` to open files changed in browser
|
|
6549
|
+
- **nudge** — run \`prq nudge {number} --yes\`
|
|
6550
|
+
- **open** — run \`prq open {number}\`
|
|
6551
|
+
|
|
6552
|
+
## Step 4: Batch operations
|
|
6553
|
+
|
|
6554
|
+
If the user says things like "review all needs-re-review PRs" or "nudge all stale PRs":
|
|
6555
|
+
|
|
6556
|
+
1. Filter the queue JSON by the requested category
|
|
6557
|
+
2. Confirm the list with the user: "I'll review these 3 PRs: #2439, #2380, #2352. Proceed?"
|
|
6558
|
+
3. Execute the action on each PR sequentially
|
|
6559
|
+
|
|
6560
|
+
## Examples
|
|
6561
|
+
|
|
6562
|
+
**User:** "check my review queue"
|
|
6563
|
+
→ Run \`prq status --json\`, present results, ask what to do
|
|
6564
|
+
|
|
6565
|
+
**User:** "review 2439"
|
|
6566
|
+
→ Look up action for "review", interpolate with PR data, execute
|
|
6567
|
+
|
|
6568
|
+
**User:** "nudge all stale PRs"
|
|
6569
|
+
→ Filter stale PRs from queue, confirm, run nudge on each
|
|
6570
|
+
|
|
6571
|
+
**User:** "what PRs are waiting on me?"
|
|
6572
|
+
→ Run \`prq status --json\`, show only needs-re-review and requested categories
|
|
6573
|
+
|
|
6574
|
+
**User:** "/prq" with no context
|
|
6575
|
+
→ Run \`prq status --json\`, present full queue, ask what to do
|
|
6576
|
+
`;
|
|
6577
|
+
function skillCommand(global) {
|
|
6578
|
+
if (global) {
|
|
6579
|
+
const fs2 = __require("node:fs");
|
|
6580
|
+
const path2 = __require("node:path");
|
|
6581
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
6582
|
+
const skillDir = path2.join(home, ".claude", "skills", "prq");
|
|
6583
|
+
const skillPath = path2.join(skillDir, "SKILL.md");
|
|
6584
|
+
fs2.mkdirSync(skillDir, { recursive: true });
|
|
6585
|
+
fs2.writeFileSync(skillPath, SKILL_CONTENT);
|
|
6586
|
+
console.log(`Installed to ${skillPath}`);
|
|
6587
|
+
} else {
|
|
6588
|
+
const fs2 = __require("node:fs");
|
|
6589
|
+
const skillDir = ".claude/skills/prq";
|
|
6590
|
+
const skillPath = `${skillDir}/SKILL.md`;
|
|
6591
|
+
fs2.mkdirSync(skillDir, { recursive: true });
|
|
6592
|
+
fs2.writeFileSync(skillPath, SKILL_CONTENT);
|
|
6593
|
+
console.log(`Installed to ${skillPath}`);
|
|
6594
|
+
}
|
|
6595
|
+
}
|
|
6596
|
+
|
|
6481
6597
|
// src/categorize.ts
|
|
6482
6598
|
function timeAgo(dateStr) {
|
|
6483
6599
|
const now = Date.now();
|
|
@@ -10919,6 +11035,9 @@ function createCLI() {
|
|
|
10919
11035
|
const config = loadConfig({});
|
|
10920
11036
|
await runCommand(action, identifier, config);
|
|
10921
11037
|
});
|
|
11038
|
+
program2.command("skill").description("Install the /prq skill for Claude Code").option("-g, --global", "Install globally (~/.claude/skills/prq/)").action((opts) => {
|
|
11039
|
+
skillCommand(opts.global ?? false);
|
|
11040
|
+
});
|
|
10922
11041
|
program2.command("init").description("Create config file interactively").action(async () => {
|
|
10923
11042
|
await initCommand();
|
|
10924
11043
|
});
|