pi-orchestrator-config 4.8.5 → 4.9.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/README.md CHANGED
@@ -75,6 +75,7 @@ for `git-expert` to commit.
75
75
  | `/refine-review <url>` | Refine and improve existing PR review comments |
76
76
  | `/coderabbit-rate-limit [number\|url]` | Handle CodeRabbit rate limiting on PRs |
77
77
  | `/create-coms-feature-manager` | Generate a coms feature-manager prompt customized for the current project (source template: `templates/coms-feature-manager-prompt.md`) |
78
+ | `/create-commit <message>` | Commit and push the current change set via git-expert (source template: `templates/commit-prompt.md` — stage exact files, commit, push, report sha) |
78
79
  | `/query-db <command>` | Query the review comments database |
79
80
  | `/external-ai <agent> [--model <model>] [--session-id <id>] [--fix\|--peer\|--resume] <prompt>` | Run prompts via AI CLIs directly (cursor, claude, gemini) — full model access |
80
81
  | `/external-ai-models-refresh` | Refresh cached AI CLI models for autocomplete |
@@ -767,12 +768,30 @@ PI_PIDIFF_ENABLE=false pi
767
768
  | `myk-pi-tools pr claude-md` | Fetch `CLAUDE.md` and `AGENTS.md` content for a PR's repository |
768
769
  | `myk-pi-tools release create` | Create a GitHub release with changelog |
769
770
  | `myk-pi-tools db` | Review database query commands |
770
- | `myk-pi-tools reviews` | Review handling commands |
771
+ | `myk-pi-tools reviews` | Review handling commands (fetch, poll, address, post, store) |
772
+ | `myk-pi-tools reviews address` | Apply replies/statuses to a fetched reviews JSON, then post and store it (see below) |
771
773
  | `myk-pi-tools memory` | Project memory commands — persistent per-repo learning |
772
774
  | `myk-pi-tools ai-cli` | AI CLI commands (cursor, claude, gemini) |
773
775
  | `myk-pi-tools coderabbit` | CodeRabbit commands (check, trigger, retry) |
774
776
  | `myk-pi-tools settings get [key ...]` | Resolve settings (project → global → env → default). No args = all keys |
775
777
 
778
+ `reviews address` — bulk-apply replies to a fetched reviews JSON, then post and store it:
779
+
780
+ ```bash
781
+ myk-pi-tools reviews address [--json <reviews.json>] [--replies <mapping.txt>] [--set <status>]
782
+ ```
783
+
784
+ - `--json`: reviews JSON to process (default: newest `pr-*-reviews.json` in `.pi/tmp`)
785
+ - `--replies`: mapping file, one rule per line — `<path>:<line>|<reply>` or `*|<reply>` (matches all pending findings);
786
+ `#` comments and blank lines ignored
787
+ - `--set`: target status for matched findings — `addressed` (default), `skipped`, `not_addressed`, or `failed`
788
+ - Without `--replies`, pending findings that already carry a reply only get their status flipped (status-only mode)
789
+ - Exit code `0` = replies posted and stored; non-zero = nothing matched, validation failed, or posting failed
790
+ (the JSON is kept for retry — re-running with the same or a corrected mapping resumes unposted entries)
791
+ - Validation failures change nothing: a rule matching several distinct findings at one location, or a status `post`
792
+ rejects for Qodo sticky findings (`not_addressed`/`failed`; `skipped` only with an issue-spec-update reply),
793
+ exits non-zero before the JSON is saved
794
+
776
795
  ### What's protected
777
796
 
778
797
  **Filesystem isolation** — the container cannot access anything outside the mounted volumes:
@@ -135,7 +135,7 @@ Format rules:
135
135
  **Commit changes:**
136
136
 
137
137
  1. `git status` to see changes
138
- 2. `git add <specific files>` for each file (NEVER `git add .`)
138
+ 2. `git add -- <specific files>` for each file (NEVER `git add .`; the `--` terminator prevents paths being read as options)
139
139
  3. Commit with proper format
140
140
  4. Report the result
141
141
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pidiff-ui",
3
3
  "private": true,
4
- "version": "4.8.5",
4
+ "version": "4.9.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-orchestrator-config",
3
- "version": "4.8.5",
3
+ "version": "4.9.0",
4
4
  "description": "Orchestrator pattern for pi: specialist subagents, enforcement, code review loop, workflow commands",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -0,0 +1,58 @@
1
+ ---
2
+ description: "Commit and push the current change set via git-expert — /create-commit <message>"
3
+ argument-hint: "<message>"
4
+ ---
5
+
6
+ ## Raw Arguments
7
+
8
+ ```text
9
+ $ARGUMENTS
10
+ ```
11
+
12
+ # Create Commit Prompt
13
+
14
+ Generates the git-expert commit delegation from the template instead of composing
15
+ the instruction prose. Only the file list and message vary per commit.
16
+
17
+ ## Workflow
18
+
19
+ ### Step 1: Read the Template
20
+
21
+ Read the template file:
22
+
23
+ ```text
24
+ ~/.pi/agent/npm/node_modules/pi-orchestrator-config/templates/commit-prompt.md
25
+ ```
26
+
27
+ Developer checkout fallback: `templates/commit-prompt.md` in the pi-config repo.
28
+ This is the immutable source template. NEVER modify it.
29
+
30
+ ### Step 2: Fill Placeholders
31
+
32
+ | Placeholder | Value |
33
+ |-------------|-------|
34
+ | `{{FILES}}` | Every file to commit, one hyphen bullet per file, exact paths — parse `git status --porcelain=v1 -z` per the rules below |
35
+ | `{{MESSAGE}}` | Commit subject — the FIRST LINE of the raw arguments, nothing more. If empty, draft a conventional `type(scope): description` subject from the change set and confirm with the user |
36
+ | `{{BODY}}` | The remainder of the raw arguments after the first line, if any — never duplicates `{{MESSAGE}}` content. Empty by default |
37
+
38
+ **Parsing `git status --porcelain=v1 -z`** (NUL-delimited; avoids quote ambiguity):
39
+
40
+ - Rename (`R`) and copy (`C`) records: list only the NEW/destination path
41
+ - C-escaped quoted paths: decode to the real path; deleted paths: keep as-is
42
+ - Paths containing newlines or control characters: render them in `printf '%q'` shell-escaped form so the bullet keeps one line — git-expert decodes before staging
43
+
44
+ If `git status` shows files that clearly should not be committed (generated
45
+ artifacts, `.env`, secrets), exclude them from `{{FILES}}` and say so.
46
+
47
+ Never leave a `{{...}}` token in the output. If the commit text contains a run of
48
+ four or more backticks, lengthen the template's code fences to exceed it
49
+ (fences must always out-length any backtick run inside).
50
+
51
+ ### Step 3: Delegate
52
+
53
+ Delegate the filled template to `git-expert` **verbatim** — no extra prose,
54
+ no re-wording, no added instructions.
55
+
56
+ ### Step 4: Report
57
+
58
+ Report git-expert's result: commit sha, branch, push outcome.
@@ -371,11 +371,27 @@ No "this looks similar to the one I already fixed."**
371
371
 
372
372
  If any approved tasks weren't implemented, review with user.
373
373
 
374
- ### Phase 5: Persist Decisions
374
+ ### Phase 5: Prepare Reply Mappings
375
375
 
376
- Update each JSON entry with `status` and `reply` fields before posting.
376
+ 🚨 **NEVER hand-edit the reviews JSON.** No python heredocs, no `jq`, no manual
377
+ `status`/`reply` field mutation. The `myk-pi-tools reviews address` command applies
378
+ replies, flips statuses, posts, and stores in one step — you only prepare mapping files.
377
379
 
378
- **Valid status values:**
380
+ Write one mapping file per target status. Each line targets one finding:
381
+
382
+ ```text
383
+ <path>:<line>|<reply>
384
+ ```
385
+
386
+ - `<path>:<line>` — the finding's fetched `path` and `line`. A thread finding and its
387
+ paired sticky finding are addressed together automatically (the command handles
388
+ dedupe and pairing — you never target stickies separately).
389
+ - `*` — matches ALL pending findings (single-line mapping file).
390
+ - Group findings by their target status — Phase 8 runs one `reviews address` call per
391
+ status group.
392
+ - Posting happens in Phase 8, AFTER commit/push — do not post before the fixes are pushed.
393
+
394
+ **Valid status values (the `--set` flag for each mapping group):**
379
395
 
380
396
  | Status | Behavior |
381
397
  |--------|----------|
@@ -438,44 +454,52 @@ Skip asking the user — commit and push automatically.
438
454
  Code must be pushed before posting replies so that reviewers can see the fixes
439
455
  when threads are resolved.
440
456
 
441
- ### Phase 8: Post Replies
457
+ ### Phase 8: Post Replies (via reviews address)
442
458
 
443
- Post all replies to GitHub and store results in the database.
444
-
445
- **Body comments (outside-diff, major, minor, nitpick, duplicate, qodo sticky):**
446
-
447
- Comments that don't have GitHub review threads (e.g., CodeRabbit outside-diff,
448
- major, minor, nitpick, and duplicate comments) are replied to via a single
449
- consolidated PR comment per reviewer. The comment mentions the reviewer (e.g., `@coderabbitai`)
450
- and includes sections for each comment with the decision made. This ensures
451
- automated reviewers know their comments were reviewed and won't re-raise them.
452
-
453
- Post replies to GitHub:
459
+ Run one `reviews address` call per status group prepared in Phase 5 — each call applies
460
+ the mapping, posts replies, resolves threads, and stores to the database:
454
461
 
455
462
  ```bash
456
- myk-pi-tools reviews post {json_path}
463
+ myk-pi-tools reviews address --json {json_path} --replies {mapping_file} --set addressed
464
+ myk-pi-tools reviews address --json {json_path} --replies {mapping_file} --set skipped
457
465
  ```
458
466
 
459
- If the command exits with a non-zero code, some threads failed to post.
460
- The command prints an ACTION REQUIRED message with the exact retry command.
461
- Re-run it to retry — only unposted entries are retried. Repeat until all succeed.
462
-
463
- **Output verification (MANDATORY):**
464
-
465
- After `reviews post` completes successfully, check the output:
467
+ The command picks the newest `pr-*-reviews.json` in `.pi/tmp` when `--json` is omitted.
466
468
 
467
- - `Processed N threads` — N should equal the number of entries with status `addressed`, `not_addressed`, `skipped`, or `failed` (everything except `pending`)
468
- - `Resolved: N` — should be non-zero if any entries have status `addressed` or if AI-source entries have status `skipped`/`not_addressed`
469
- - If `Processed 0 threads`, the status values in the JSON are wrong — fix them to use valid values from the table above and re-run before proceeding
470
- - If output shows `Warning: Unknown status`, fix those entries — e.g., `"done"` or `"completed"` are not valid, use `"addressed"` instead
469
+ **Multi-group retention:** while any findings remain pending (unposted, not
470
+ auto-skipped), a successful run posts its group but does NOT store — the JSON is
471
+ kept on disk for the remaining status-group runs. The final run (nothing pending)
472
+ stores to the database and consumes the JSON. Run the groups in any order.
471
473
 
472
- Do NOT proceed to `reviews store` until `reviews post` shows the expected thread count.
473
-
474
- Store to database:
474
+ **Body comments (outside-diff, major, minor, nitpick, duplicate, qodo sticky):**
475
475
 
476
- ```bash
477
- myk-pi-tools reviews store {json_path}
478
- ```
476
+ Comments that don't have GitHub review threads (e.g., CodeRabbit outside-diff,
477
+ major, minor, nitpick, and duplicate comments) are replied to via a single
478
+ consolidated PR comment per reviewer — `reviews address` handles this exactly like
479
+ `reviews post` did: the comment mentions the reviewer (e.g., `@coderabbitai`) and
480
+ includes sections for each comment with the decision made. This ensures automated
481
+ reviewers know their comments were reviewed and won't re-raise them.
482
+
483
+ **Failure semantics (MANDATORY):**
484
+
485
+ - **Exit 0** → all matched findings posted. Threads are resolved per the
486
+ Phase 5 status table — `addressed` (and AI-source `skipped`/`not_addressed`) threads
487
+ are resolved; **human `skipped`/`not_addressed` threads intentionally stay open** for
488
+ follow-up. Exit 0 never means every thread is resolved.
489
+ Storage happens only on the FINAL group: while pending findings remain the run posts
490
+ without storing (results live in the retained JSON until the last group's run stores
491
+ and consumes it).
492
+ - **Non-zero exit** → the JSON is RETAINED on disk for a corrected re-run.
493
+ Read the printed error:
494
+ - `no findings matched` → a mapping `path:line` matches no pending finding — fix the
495
+ mapping file and re-run. Already-posted entries are never touched again, so re-runs
496
+ are always safe.
497
+ - Post/resolve failures → the output names the entries that failed; re-run the same
498
+ command. Re-runs retry BOTH unposted entries AND posted-but-unresolved threads
499
+ (entries with `posted_at` but no resolution are resumed automatically — a failed
500
+ resolve retries the already-posted thread).
501
+ - **NEVER delete or hand-edit a retained JSON** — correct the mapping file and re-run
502
+ `reviews address`.
479
503
 
480
504
  ### Phase 9: Auto Polling Loop (--autorabbit / --autoqodo mode)
481
505
 
@@ -0,0 +1,38 @@
1
+ # Commit Delegation — Template
2
+
3
+ > **Usage:** The orchestrator fills every `{{PLACEHOLDER}}` and delegates the
4
+ > filled text to git-expert. Delete this usage block when done.
5
+
6
+ ---
7
+
8
+ Commit and push the current change set.
9
+
10
+ **Files to stage — EXACTLY these, never `git add .` or `git add -A`:**
11
+
12
+ {{FILES}}
13
+
14
+ **Commit message** (subject only — never body content):
15
+
16
+ ````text
17
+ {{MESSAGE}}
18
+ ````
19
+
20
+ **Commit body** (omit entirely if empty):
21
+
22
+ ````text
23
+ {{BODY}}
24
+ ````
25
+
26
+ **Steps:**
27
+
28
+ 1. Stage each file listed above individually — always `git add -- <file>`
29
+ (the `--` terminator is mandatory; never let a path be read as an option),
30
+ one command naming every file is fine. Quote paths containing spaces or
31
+ special characters; if a path contains glob characters or pathspec magic
32
+ (`*`, `?`, `:` …), stage it as `git add -- ':(literal)<file>'` so it is
33
+ treated as an exact path, never a pattern. If a path was rendered in
34
+ shell-escaped form (`printf '%q'`), decode it before staging.
35
+ 2. Commit with the message (and body if present) above — use a HEREDOC for multi-line.
36
+ The message and body must never duplicate each other.
37
+ 3. Push the current branch to origin (set upstream with `-u` if the branch has none).
38
+ 4. Report: commit sha, branch, push result.