@raquezha/norpiv 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sync/SKILL.md +89 -87
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raquezha/norpiv",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Bundled RPIV workflow skills for Pi, Claude, and Codex-style coding agents",
5
5
  "type": "commonjs",
6
6
  "bin": {
package/sync/SKILL.md CHANGED
@@ -7,20 +7,24 @@ description: Synchronizes local RPIV task state (WORK.md) to external trackers (
7
7
 
8
8
  # Skill: sync
9
9
 
10
- Maintains consistency between local `.workflow` state and the remote source of truth using a single Pi-owned living status comment per task.
10
+ Maintains consistency between local `.workflow` state and external remote trackers (Jira, GitHub, GitLab) across primary tasks and all related items (parents, sub-issues, mentioned items, linked PRs/MRs).
11
11
 
12
12
  ## Guardrails
13
13
  - **Pre-flight**: Always read `.workflow/active.json` first, then compatibility `.workflow/active_task.json` only if needed, and the active `WORK.md` before executing.
14
+ - **Context-First Verification (100% Certainty Rule)**: Read the primary issue and trace all related issues (parents, sub-issues, mentioned issues `#123`, linked PRs/MRs) BEFORE executing remote mutations. Gather full context first and only update descriptions, tick checkboxes, or change issue statuses when 100% certain based on verified code and test evidence.
15
+ - **Universal Multi-Issue Sync**: Regardless of platform (Jira, GitHub, GitLab), evaluate and update all related items in the task tree:
16
+ - **Primary Child Item**: Update description checkboxes (`- [x]`), post/update living status comment (`<!-- pi-sync-marker -->`), and close/transition to Done/Closed when work and acceptance criteria are complete.
17
+ - **Parent / Track Item**: Update parent track descriptions to tick off child issue progress (e.g. `- [x] #174 ...`) and parent acceptance criteria. Keep umbrella parent issues open for high-level tracking unless all child items are complete.
18
+ - **Mentioned / Linked Items**: Inspect mentioned or linked items (`Refs #123`, `Fixes #123`, sub-tasks) and update their checkboxes and status when verified.
14
19
  - **Privacy**: NEVER sync secrets, environment variables, or private notes not intended for stakeholders.
15
- - **Integrity**: Do not modify `[BRIEF]` or `[GRILL]` sections.
16
- - **Idempotency**: If the remote Pi status already reflects the current local state, do not post or update.
17
- - **Human safety**: NEVER edit human-authored comments. Only update comments/notes containing the Pi sync marker.
18
- - **Target ownership**: Sync the executable child issue/MR/PR that the work completed, not the umbrella parent, unless the user explicitly asks for parent status. If the active GitHub issue has sub-issues, verify the PR/body/current request points to the right child before posting.
19
- - **Hyperlinks**: Always format issue references (e.g. `[#140](https://github.com/owner/repo/issues/140)`), source file paths, git branches, and commit hashes as explicit Markdown hyperlinks in sync comments whenever applicable.
20
- - **Shell safety**: Never pass markdown bodies inline through shell strings. Write bodies to files and use `--body-file` or JSON `--input` API calls so backticks and `$()` cannot execute.
20
+ - **Integrity**: Do not modify `[BRIEF]` or `[GRILL]` sections in local `WORK.md`.
21
+ - **Idempotency**: If remote descriptions, statuses, and Pi status comments already reflect current local state, do not post duplicate comments or redundant updates.
22
+ - **Human Safety**: NEVER edit human-authored comments. Only update status comments containing `<!-- pi-sync-marker -->`.
23
+ - **Hyperlinks**: Format issue references (e.g. `[#140](https://github.com/owner/repo/issues/140)`), file paths, git branches, commit hashes (`[\`35bd81b\`](url)`), and PR/MR links as explicit Markdown hyperlinks in sync comments whenever applicable.
24
+ - **Shell Safety**: Never pass markdown bodies inline through shell strings. Write bodies to files and use `--body-file` or JSON `--input` API calls so backticks and `$()` cannot execute.
21
25
 
22
26
  ## Living status marker
23
- Every sync body MUST include this marker at the end:
27
+ Every sync status comment MUST include this marker at the end:
24
28
 
25
29
  ```md
26
30
  <!-- pi-sync-marker -->
@@ -48,97 +52,95 @@ Do **not** use latest-comment ownership as the primary decision. Latest-comment-
48
52
 
49
53
  ## Workflow
50
54
 
51
- ### 1. Discovery & State Loading
52
- - Identify the platform and ID from `.workflow/active.json`, falling back to compatibility `.workflow/active_task.json` only when required.
53
- - For GitHub, check hierarchy before syncing umbrella issues:
54
- ```bash
55
- gh issue view <id> --json parent,subIssues --jq '{parent:.parent, subIssues:.subIssues}'
56
- ```
57
- If the issue has sub-issues and the work maps to one child, switch the sync target to that child or ask once. Do not sync a child deliverable to the parent just because the active task points at the parent.
58
- - Extract **Slices** from `[PLAN]`, **Status** from `[LOG]`, and **Artifacts** such as PR/MR links, commit hashes, and verification output.
59
-
60
- ### 2. Payload Preparation
61
- Format the message for two audiences:
62
- - **Stakeholders**: summarize outcome, current state, and next step.
63
- - **Developers**: list vertical slices, commit/PR/MR links, and verification evidence.
64
- - **Hyperlinking**: convert issue identifiers (`[#140](url)`), commit hashes (`[\`0011b4b\`](url)`), branch names (`[\`feat/140\`](url)`), and key file paths into explicit markdown hyperlinks so they render as interactive links.
65
- - **Signature and marker**: always append both the signature and `<!-- pi-sync-marker -->`.
66
-
67
- ### 3. Execution
55
+ ### 1. Context Gathering & Traversal (Read-First Protocol)
56
+ - Identify primary task platform and ID from `.workflow/active.json` / `WORK.md`.
57
+ - **Fetch Primary Item**: Read primary issue details (title, body, state, acceptance criteria, labels).
58
+ - **Trace Related Graph**:
59
+ - **GitHub**: Fetch parent issue (`gh issue view <id> --json parent,subIssues`), mentioned issues in `WORK.md` intake/brief (e.g. `Parent track: #166`, `Refs #174`), and linked PRs (`gh issue view <id> --json closingPRs`).
60
+ - **Jira**: Fetch parent epic, sub-tasks, linked issues, and issue links (`jira issue view <id>`).
61
+ - **GitLab**: Fetch parent epic, child issues, related merge requests (`glab issue view <id>`).
62
+ - **Verify Evidence**: Confirm test runs, commit hashes, merged PRs/MRs, and acceptance criteria in `WORK.md`.
63
+
64
+ ### 2. Multi-Item Update Strategy (100% Certainty Check)
65
+ Only proceed with remote mutations after confirming complete context:
66
+ - **Descriptions & Checkboxes**:
67
+ - Update primary issue body to tick completed acceptance criteria (`- [x]`).
68
+ - Update parent track body to tick completed child track items (`- [x] #174 ...`).
69
+ - Use JSON payload `--input` or `--body-file` to safely update issue descriptions without escaping errors.
70
+ - **Status & Transitions**:
71
+ - Close/transition executable child items to `Closed` / `Done` after PR merge and acceptance criteria verification.
72
+ - Preserve umbrella parent issues as `Open` until all child items in the track are complete.
73
+ - **Living Status Comment**:
74
+ - Prepare and publish/update the living status comment with `<!-- pi-sync-marker -->` on the primary task item (and parent item if requested).
75
+
76
+ ### 3. Execution Helpers by Platform
68
77
 
69
78
  #### Jira
70
- Use the helper so ADF parsing and marker search stay centralized:
79
+ Use the centralized smart sync helper for status comments:
71
80
 
72
81
  ```bash
73
82
  cat body.md | <skill_location>/jira_smart_sync.sh <ISSUE_ID>
74
83
  ```
75
84
 
76
- Behavior:
77
- - fetch recent comments newest-first, default limit `50`
78
- - override limit with `PI_SYNC_COMMENT_LIMIT=<n>` if needed
79
- - find newest marker comment anywhere in the fetched window
80
- - update marker comment by ID, no-op if identical, create only if no marker exists
85
+ For issue description/checkbox and status updates:
86
+ - Update description: use `acli` or Jira REST API with JSON body payload.
87
+ - Transition status: `acli transitionIssue --issue <ID> --step "Done"` or API transition.
81
88
 
82
89
  #### GitHub Issues / PRs
83
- Use the issue comments API. PR comments use issue comments for PR body discussion.
84
-
85
- Check:
86
- ```bash
87
- gh api repos/:owner/:repo/issues/<id>/comments --paginate \
88
- --jq 'map(select(.body | contains("<!-- pi-sync-marker -->"))) | last'
89
- ```
90
-
91
- Update:
92
- ```bash
93
- jq -n --rawfile body body.md '{body: $body}' > body.json
94
- gh api -X PATCH repos/:owner/:repo/issues/comments/<comment_id> \
95
- --input body.json
96
- ```
97
-
98
- Create:
99
- ```bash
100
- gh issue comment <id> --body-file body.md
101
- ```
102
-
103
- Rules:
104
- - update only a comment containing the marker
105
- - no-op when normalized body is already current
106
- - create only when no marker comment exists
107
- - keep markdown in files; do not use inline `-f body="$(cat body.md)"` or shell-expanded PR/comment bodies
90
+ - **Fetch Related Context**:
91
+ ```bash
92
+ gh issue view <id> --json parent,subIssues,body,state
93
+ ```
94
+ - **Update Description (Checkboxes)**:
95
+ ```bash
96
+ jq -n --rawfile body updated_issue_body.md '{body: $body}' > update_payload.json
97
+ gh api -X PATCH repos/:owner/:repo/issues/<id> --input update_payload.json
98
+ ```
99
+ - **Update Status Comment**:
100
+ Check:
101
+ ```bash
102
+ gh api repos/:owner/:repo/issues/<id>/comments --paginate \
103
+ --jq 'map(select(.body | contains("<!-- pi-sync-marker -->"))) | last'
104
+ ```
105
+ Update existing comment:
106
+ ```bash
107
+ jq -n --rawfile body comment_body.md '{body: $body}' > comment_payload.json
108
+ gh api -X PATCH repos/:owner/:repo/issues/comments/<comment_id> --input comment_payload.json
109
+ ```
110
+ Create comment if missing:
111
+ ```bash
112
+ gh issue comment <id> --body-file comment_body.md
113
+ ```
114
+ - **Close Executable Child Issue**:
115
+ ```bash
116
+ gh issue close <id> --comment "Completed and verified in PR #<pr_number>."
117
+ ```
108
118
 
109
119
  #### GitLab Issues / MRs
110
- Use notes API for issues or merge requests.
111
-
112
- Check MR notes:
113
- ```bash
114
- glab api projects/:id/merge_requests/<iid>/notes --paginate \
115
- --jq 'map(select(.body | contains("<!-- pi-sync-marker -->"))) | last'
116
- ```
117
-
118
- Update MR note:
119
- ```bash
120
- glab api -X PUT projects/:id/merge_requests/<iid>/notes/<note_id> \
121
- -f body=@body.md
122
- ```
123
-
124
- Create MR note:
125
- ```bash
126
- glab mr note <iid> --message "$(cat body.md)"
127
- ```
128
-
129
- Rules:
130
- - update only a note containing the marker
131
- - no-op when normalized body is already current
132
- - create only when no marker note exists
120
+ - **Fetch Context**:
121
+ ```bash
122
+ glab issue view <id>
123
+ ```
124
+ - **Update Description & Status**:
125
+ ```bash
126
+ glab issue update <id> --description "$(cat updated_body.md)"
127
+ glab issue close <id>
128
+ ```
129
+ - **Update Status Note**:
130
+ ```bash
131
+ glab api -X PUT projects/:id/issues/<id>/notes/<note_id> -f body=@comment_body.md
132
+ ```
133
133
 
134
- ### 4. Local Confirmation
135
- - Append a timestamped sync record to `WORK.md` `[LOG]` with action: `no-op`, `updated`, or `created`.
136
- - Do not edit `[BRIEF]` or `[GRILL]`.
134
+ ### 4. Local Confirmation & Logging
135
+ - Append a timestamped sync entry to `WORK.md` `[LOG]` recording:
136
+ - Primary target updated (description checkboxes, status comment, closed/transitioned).
137
+ - Related items updated (parent track checkboxes, sub-issue statuses).
138
+ - Explicit URLs for status comments and PRs/MRs.
139
+ - Preserve guarded `[BRIEF]` and `[GRILL]` sections untouched.
137
140
 
138
141
  ## Output Contract
139
142
  Return a concise summary:
140
- - **Target**: platform and issue/PR/MR ID
141
- - **Action**: no-op / updated existing status / created new status
142
- - **Reason**: marker found, body identical, marker missing, etc.
143
- - **Link**: remote comment/note URL if available
144
- - **Next step**: review, verify, post-merge-prune, or continue implementation
143
+ - **Primary Target**: platform and issue ID, status transition (e.g. `Closed`), description checkboxes updated.
144
+ - **Related Items Updated**: list of parent tracks (`#166`), sub-issues, or mentioned issues updated (`- [x] #174`).
145
+ - **Living Status Comment**: `no-op` / `updated` / `created` with remote comment URL.
146
+ - **Next Step**: review, post-merge-prune, or proceed to next RPIV task.