@nvice-r/pr-commands 0.1.0 → 0.1.1

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
@@ -73,7 +73,7 @@ every clone and every git worktree, no symlinks.
73
73
  | Shared library | `~/.local/bin/pr-common.sh` |
74
74
  | Provider binary | `~/.local/bin/bbpr` (`ghpr`/`glpr` later) |
75
75
  | Config | `~/.config/pr/config` |
76
- | Reviewer roster | `<main-repo-root>/.pr-reviewers.txt` (shared across worktrees) |
76
+ | Reviewer roster | `<main-repo-root>/<agent_dir>/pr-reviewers.txt` (default `.claude`; shared across worktrees) |
77
77
  | `/pr` skill | `~/.claude/commands/pr.md` |
78
78
 
79
79
  ## Usage
@@ -124,11 +124,12 @@ template_sections=Context|Changes|Risk
124
124
 
125
125
  ### Reviewers
126
126
 
127
- Roster lives **in the work dir** at the main repo root, so it's editable next to the code.
128
- Resolved via `git --git-common-dir/..`, so all worktrees of a repo share one roster:
127
+ Roster lives **in the agent folder** under the main repo root (`agent_dir` in config, default
128
+ `.claude`), so it's editable next to the code. Resolved via `git --git-common-dir/..`, so all
129
+ worktrees of a repo share one roster:
129
130
 
130
131
  ```
131
- <main-repo-root>/.pr-reviewers.txt
132
+ <main-repo-root>/.claude/pr-reviewers.txt # or <agent_dir>/… — .cursor, .aider, …
132
133
  ```
133
134
 
134
135
  You (the author) are excluded on install — bbpr also drops self at PR time. One entry per line,
@@ -140,9 +141,9 @@ trailing `# Name` comment optional:
140
141
  ```
141
142
 
142
143
  It's plain data — edit freely, no reinstall. Consider gitignoring it unless the team wants the
143
- roster committed. Load order: `$BBPR_REVIEWERS` → work-dir file → global
144
- `~/.config/pr/reviewers/<ws>-<slug>.txt` → legacy. Run-time overrides: `--no-reviewers` skips
145
- all, `--reviewer <uuid>` appends.
144
+ roster committed. Load order: `$BBPR_REVIEWERS` → `<agent_dir>/pr-reviewers.txt` → root
145
+ `.pr-reviewers.txt` (pre-0.1.1) → global `~/.config/pr/reviewers/<ws>-<slug>.txt` → legacy.
146
+ Run-time overrides: `--no-reviewers` skips all, `--reviewer <uuid>` appends.
146
147
 
147
148
  ### Auth precedence (email)
148
149
 
@@ -193,7 +194,7 @@ rm ~/.local/bin/bbpr ~/.local/bin/pr-common.sh
193
194
  rm -rf ~/.config/pr
194
195
  rm ~/.claude/commands/pr.md
195
196
  # roster lives in each repo — remove per repo if wanted:
196
- rm <main-repo-root>/.pr-reviewers.txt
197
+ rm <main-repo-root>/.claude/pr-reviewers.txt
197
198
  ```
198
199
 
199
200
  ## Development
@@ -20,11 +20,11 @@ CONFIG_FILE="${PR_CONFIG:-$HOME/.config/pr/config}"
20
20
  die() { echo "${PR_CMD:-pr}: $*" >&2; exit 1; }
21
21
 
22
22
  # --- config load (safe parse, no `source` of untrusted file) ---
23
- # Sets: CFG_OS CFG_TOKEN_SRC CFG_EMAIL CFG_CONVENTION (+ optional custom_* keys)
23
+ # Sets: CFG_OS CFG_TOKEN_SRC CFG_EMAIL CFG_CONVENTION CFG_AGENT_DIR (+ optional custom_* keys)
24
24
  pr_load_config() {
25
25
  [ -f "$CONFIG_FILE" ] || die "no $CONFIG_FILE — run: npx @nvice-r/pr-commands"
26
26
  local k v
27
- CFG_OS=""; CFG_TOKEN_SRC=""; CFG_EMAIL=""; CFG_CONVENTION=""
27
+ CFG_OS=""; CFG_TOKEN_SRC=""; CFG_EMAIL=""; CFG_CONVENTION=""; CFG_AGENT_DIR=""
28
28
  while IFS='=' read -r k v; do
29
29
  k="${k%%#*}"; k="${k//[[:space:]]/}" # strip comment + whitespace from key
30
30
  [ -z "$k" ] && continue
@@ -34,9 +34,11 @@ pr_load_config() {
34
34
  token_src) CFG_TOKEN_SRC="$v" ;;
35
35
  email) CFG_EMAIL="$v" ;;
36
36
  convention) CFG_CONVENTION="$v" ;;
37
+ agent_dir) CFG_AGENT_DIR="$v" ;;
37
38
  esac
38
39
  done < "$CONFIG_FILE"
39
40
  : "${CFG_TOKEN_SRC:=keychain}"
41
+ : "${CFG_AGENT_DIR:=.claude}" # agent folder holding the roster (relative to main repo root)
40
42
  }
41
43
 
42
44
  # --- token retrieval, OS-switched (D1: OS is a function, not a binary axis) ---
@@ -127,9 +129,10 @@ pr_load_reviewers() {
127
129
  # main repo root, shared across worktrees: git-common-dir/.. (empty if git call fails)
128
130
  local mainroot; mainroot="$(cd "$(git rev-parse --git-common-dir 2>/dev/null)/.." 2>/dev/null && pwd)"
129
131
  for cand in \
132
+ ${mainroot:+"$mainroot/${CFG_AGENT_DIR:-.claude}/pr-reviewers.txt"} \
130
133
  ${mainroot:+"$mainroot/.pr-reviewers.txt"} \
131
134
  "$HOME/.config/pr/reviewers/${slug}.txt" \
132
- "$HOME/.config/bbpr/bbpr-reviewers.txt"; do # legacy fallback
135
+ "$HOME/.config/bbpr/bbpr-reviewers.txt"; do # global + legacy fallbacks
133
136
  [ -f "$cand" ] && { file="$cand"; break; }
134
137
  done
135
138
  fi
package/install.js CHANGED
@@ -35,17 +35,19 @@ const PRESET_DEFS = {
35
35
 
36
36
  // ---- arg parse ----
37
37
  const argv = process.argv.slice(2);
38
- const flags = { dir: null, provider: null, all: false, yes: false, dryRun: false };
38
+ const flags = { dir: null, provider: null, all: false, yes: false, dryRun: false, agentDir: null };
39
39
  for (let i = 0; i < argv.length; i++) {
40
40
  const a = argv[i];
41
41
  if (a === '--help' || a === '-h') { printHelp(); process.exit(0); }
42
42
  else if (a === '--dir') flags.dir = argv[++i];
43
43
  else if (a === '--provider') flags.provider = argv[++i];
44
+ else if (a === '--agent-dir') flags.agentDir = argv[++i];
44
45
  else if (a === '--all') flags.all = true;
45
46
  else if (a === '--yes' || a === '-y') flags.yes = true;
46
47
  else if (a === '--dry-run') flags.dryRun = true;
47
48
  else { console.error(`unknown flag: ${a}`); process.exit(1); }
48
49
  }
50
+ const AGENT_DIR = (flags.agentDir || '.claude').replace(/^\/+|\/+$/g, ''); // strip stray slashes
49
51
 
50
52
  function printHelp() {
51
53
  console.log(`@nvice-r/pr-commands installer
@@ -54,6 +56,7 @@ function printHelp() {
54
56
 
55
57
  --dir <path> Repo to configure (default: cwd)
56
58
  --provider <p> Force bitbucket|github|gitlab (default: detect from remote)
59
+ --agent-dir <dir> Agent folder for the roster, relative to main repo root (default: .claude)
57
60
  --all Install all provider binaries (default: only the detected one)
58
61
  --yes Accept defaults, no prompts (reviewers=all, convention=trueid)
59
62
  --dry-run Print planned actions, write nothing
@@ -443,16 +446,16 @@ async function fetchBitbucketReviewers(slug, email, token, selfUuid) {
443
446
  // --- install ---
444
447
  screen(3, 'Install');
445
448
  const { slug, pcfg, email, convention, conv, chosen } = st;
446
- let cfg = `os=${cfgOs}\ntoken_src=${tokenSrc}\nemail=${email}\nconvention=${convention}\n`;
449
+ let cfg = `os=${cfgOs}\ntoken_src=${tokenSrc}\nemail=${email}\nconvention=${convention}\nagent_dir=${AGENT_DIR}\n`;
447
450
  if (conv.title_pattern) cfg += `title_pattern=${conv.title_pattern}\n`;
448
451
  if (conv.ticket_regex) cfg += `ticket_regex=${conv.ticket_regex}\n`;
449
452
  if (conv.template_sections) cfg += `template_sections=${conv.template_sections}\n`;
450
453
  writeFile(path.join(HOME, '.config/pr/config'), cfg, 0o600);
451
- // Roster lives in the work dir (main repo root — shared across worktrees). Editable
452
- // in place; pr-common.sh finds it first, falling back to the global path.
454
+ // Roster lives in the agent dir under the main repo root (shared across worktrees). Editable
455
+ // in place; pr-common.sh finds it first, falling back to root/global/legacy paths.
453
456
  const roster = chosen.map((r) => `${r.uuid} # ${r.name}`).join('\n') + (chosen.length ? '\n' : '');
454
457
  const header = `# pr reviewers for ${slug} — {uuid} # Name per line; blanks/# ignored. Edit freely.\n`;
455
- writeFile(path.join(st.mainRoot, '.pr-reviewers.txt'), header + (roster || '# (none selected)\n'));
458
+ writeFile(path.join(st.mainRoot, AGENT_DIR, 'pr-reviewers.txt'), header + (roster || '# (none selected)\n'));
456
459
  const binDir = path.join(HOME, '.local/bin');
457
460
  const binsToInstall = flags.all
458
461
  ? Object.values(PROVIDERS).filter((p) => p.ready).map((p) => p.bin)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nvice-r/pr-commands",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Provider-agnostic PR helper for Claude Code — npx installer + bbpr/ghpr/glpr binaries + /pr skill",
5
5
  "bin": {
6
6
  "pr-commands": "install.js"
@@ -15,7 +15,14 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
- "keywords": ["claude-code", "pull-request", "bitbucket", "github", "gitlab", "cli"],
18
+ "keywords": [
19
+ "claude-code",
20
+ "pull-request",
21
+ "bitbucket",
22
+ "github",
23
+ "gitlab",
24
+ "cli"
25
+ ],
19
26
  "author": "nvice.r",
20
27
  "license": "MIT"
21
28
  }