@mars-stack/core 0.4.0 → 1.0.2
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/cursor/manifest.json
CHANGED
|
@@ -299,6 +299,12 @@
|
|
|
299
299
|
"dependencies": ["create-execution-plan", "update-architecture-docs"],
|
|
300
300
|
"capabilities": ["file-edit"],
|
|
301
301
|
"meta": true
|
|
302
|
+
},
|
|
303
|
+
"address-pr-comments": {
|
|
304
|
+
"file": "skills/mars-address-pr-comments/SKILL.md",
|
|
305
|
+
"triggers": ["address PR comments", "reply to PR comments", "fix review feedback", "respond to PR review", "reply to comments with fixes", "remedial changes"],
|
|
306
|
+
"dependencies": [],
|
|
307
|
+
"capabilities": ["file-edit", "terminal"]
|
|
302
308
|
}
|
|
303
309
|
}
|
|
304
310
|
}
|
|
@@ -280,11 +280,13 @@ Set up automated cleanup using a cron job or scheduled function:
|
|
|
280
280
|
```typescript
|
|
281
281
|
// src/app/api/cron/audit-cleanup/route.ts
|
|
282
282
|
import { NextResponse } from 'next/server';
|
|
283
|
+
import { constantTimeEqual } from '@mars-stack/core/auth/crypto-utils';
|
|
283
284
|
import { cleanupOldAuditLogs } from '@/features/audit-log/server';
|
|
284
285
|
|
|
285
286
|
export async function GET(request: Request) {
|
|
286
|
-
const authHeader = request.headers.get('authorization');
|
|
287
|
-
|
|
287
|
+
const authHeader = request.headers.get('authorization') ?? '';
|
|
288
|
+
const expected = `Bearer ${process.env.CRON_SECRET}`;
|
|
289
|
+
if (!constantTimeEqual(authHeader, expected)) {
|
|
288
290
|
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
289
291
|
}
|
|
290
292
|
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Skill: Address PR Comments and Reply with Fix Links
|
|
2
|
+
|
|
3
|
+
Address pull request review comments by implementing fixes, replying to each comment thread with links to the fix, and pushing the remedial changes. Use for any PR where the user wants to "address PR comments", "reply to comments with fixes", or "fix review feedback".
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
Use this skill when the user asks to:
|
|
8
|
+
- Address PR comments, fix review feedback, or respond to PR review
|
|
9
|
+
- Reply to PR comments with links to the fix
|
|
10
|
+
- Push remedial changes after addressing review
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- Current branch is the PR branch (not `main`).
|
|
15
|
+
- GitHub CLI (`gh`) authenticated and able to read/write the repo.
|
|
16
|
+
- PR number or branch name known (e.g. from "PR #56" or "cursor/mars-development-workflow-1167").
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
### 1. Resolve PR and list review comments
|
|
21
|
+
|
|
22
|
+
Get the PR number from branch if needed:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
gh pr list --head <branch-name>
|
|
26
|
+
# or: gh pr view <branch-name>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Fetch review comments (REST) and review threads (GraphQL for replying):
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# List all PR review comments (includes body, path, line)
|
|
33
|
+
gh api repos/OWNER/REPO/pulls/PR_NUMBER/comments
|
|
34
|
+
|
|
35
|
+
# Get review thread IDs for replying (GraphQL)
|
|
36
|
+
gh api graphql -f query='
|
|
37
|
+
query {
|
|
38
|
+
repository(owner: "OWNER", name: "REPO") {
|
|
39
|
+
pullRequest(number: PR_NUMBER) {
|
|
40
|
+
reviewThreads(first: 50) {
|
|
41
|
+
nodes {
|
|
42
|
+
id
|
|
43
|
+
isResolved
|
|
44
|
+
comments(first: 3) { nodes { id databaseId body path } }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Replace `OWNER`, `REPO`, `PR_NUMBER` with the actual values (e.g. from `gh repo view` or the PR URL).
|
|
53
|
+
|
|
54
|
+
### 2. Implement fixes
|
|
55
|
+
|
|
56
|
+
For each comment:
|
|
57
|
+
|
|
58
|
+
- **Documentation / ticket moves:** Move tickets (e.g. `in-progress/` → `done/`), update exec plan links and checklist items as requested.
|
|
59
|
+
- **Code feedback:** Edit the referenced file(s) and lines to satisfy the comment (refactors, placement, use of shared utilities, etc.).
|
|
60
|
+
|
|
61
|
+
Run relevant tests after edits (e.g. `yarn workspace @mars-stack/cli test` for CLI changes).
|
|
62
|
+
|
|
63
|
+
### 3. Commit and push (get commit SHA for links)
|
|
64
|
+
|
|
65
|
+
Commit on the current branch, then push so the fix commit exists on the remote:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git add <changed-files>
|
|
69
|
+
git commit -m "fix(pr): address PR #N review comments
|
|
70
|
+
|
|
71
|
+
- Brief bullet per comment addressed"
|
|
72
|
+
git push origin <branch-name>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Capture the commit SHA for reply links (e.g. `git rev-parse HEAD` or short `git rev-parse --short HEAD`).
|
|
76
|
+
|
|
77
|
+
### 4. Reply to each review thread with fix links
|
|
78
|
+
|
|
79
|
+
Use GitHub GraphQL to add a reply to each thread. The thread ID is the `id` from the `reviewThreads.nodes` query (e.g. `PRRT_kwDORc-XH850cQlY`). Link to the fix using the commit SHA and optional line range:
|
|
80
|
+
|
|
81
|
+
**Link format:** `https://github.com/OWNER/REPO/blob/<commit_sha>/PATH#Lstart-Lend`
|
|
82
|
+
|
|
83
|
+
Example reply body (use markdown):
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
Fixed in commit <short-sha>: <one-line summary>.
|
|
87
|
+
|
|
88
|
+
**Link:** [file or description](https://github.com/OWNER/REPO/blob/<sha>/path/to/file.ts#L10-L20)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
GraphQL mutation (one reply per thread):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
gh api graphql -f query='
|
|
95
|
+
mutation {
|
|
96
|
+
addPullRequestReviewThreadReply(input: {
|
|
97
|
+
pullRequestReviewThreadId: "PRRT_...",
|
|
98
|
+
body: "Fixed in commit ab19f35: summary.\n\n**Link:** [path](https://github.com/owner/repo/blob/ab19f35/path#L1-L5)"
|
|
99
|
+
}) {
|
|
100
|
+
comment { id url }
|
|
101
|
+
}
|
|
102
|
+
}'
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- Use `pullRequestReviewThreadId` (not `threadId`).
|
|
106
|
+
- Escape newlines in the body as `\n`. Keep the body plain text or markdown; avoid complex HTML.
|
|
107
|
+
- For multiple files in one reply, list multiple links in the same reply.
|
|
108
|
+
|
|
109
|
+
### 5. Optional: single summary comment
|
|
110
|
+
|
|
111
|
+
If thread replies fail (e.g. permissions or API limits), add one PR-level comment summarizing all fixes and linking to the commit or key files:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
gh pr comment PR_NUMBER --body "**Addressed review comments:** ... (bullets + links)"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Checklist
|
|
118
|
+
|
|
119
|
+
- [ ] Fetched PR review comments and thread IDs
|
|
120
|
+
- [ ] Implemented fixes for each comment
|
|
121
|
+
- [ ] Ran tests; commit and push on PR branch
|
|
122
|
+
- [ ] Replied to each review thread with a link to the fix (commit + path, optional line range)
|
|
123
|
+
- [ ] No direct push to `main` (all changes on the PR branch)
|
|
124
|
+
|
|
125
|
+
## Notes
|
|
126
|
+
|
|
127
|
+
- **REST reply endpoint:** `POST /repos/OWNER/REPO/pulls/comments/COMMENT_ID/replies` often returns 404 for review comments; prefer GraphQL `addPullRequestReviewThreadReply` with the thread ID.
|
|
128
|
+
- **Resolved threads:** You can still reply to resolved threads; the reply will appear in the conversation.
|
|
129
|
+
- **Line numbers:** After edits, line numbers in the fix commit may differ from the original comment. Use the line numbers in the **fix commit** for the `#Lstart-Lend` fragment so the link points at the correct code.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mars-stack/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
120
|
"publishConfig": {
|
|
121
|
-
"access": "
|
|
121
|
+
"access": "public"
|
|
122
122
|
},
|
|
123
123
|
"files": [
|
|
124
124
|
"dist",
|