@cursor/july 0.1.54 → 0.1.61
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/agent-serve.js +30 -23
- package/dist/channels/github/github-channel.d.ts +12 -0
- package/dist/channels/github/github-channel.d.ts.map +1 -1
- package/dist/channels/github/github-channel.js +67 -15
- package/dist/channels/github/types.d.ts +27 -1
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/origin/cursor-account.d.ts +22 -0
- package/dist/channels/origin/cursor-account.d.ts.map +1 -0
- package/dist/channels/origin/cursor-account.js +35 -0
- package/dist/channels/origin/events.d.ts +10 -0
- package/dist/channels/origin/events.d.ts.map +1 -0
- package/dist/channels/origin/events.js +27 -0
- package/dist/channels/origin/index.d.ts +29 -0
- package/dist/channels/origin/index.d.ts.map +1 -0
- package/dist/channels/origin/index.js +28 -0
- package/dist/channels/origin/origin-channel.d.ts +68 -0
- package/dist/channels/origin/origin-channel.d.ts.map +1 -0
- package/dist/channels/origin/origin-channel.js +567 -0
- package/dist/channels/origin/origin-webhook.d.ts +38 -0
- package/dist/channels/origin/origin-webhook.d.ts.map +1 -0
- package/dist/channels/origin/origin-webhook.js +151 -0
- package/dist/channels/origin/types.d.ts +152 -0
- package/dist/channels/origin/types.d.ts.map +1 -0
- package/dist/channels/origin/types.js +1 -0
- package/dist/channels/slack/doctor.d.ts +17 -1
- package/dist/channels/slack/doctor.d.ts.map +1 -1
- package/dist/channels/slack/doctor.js +186 -10
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +4 -4
- package/dist/docs/assets/{app.DAKcDclS.js → app.CW3KJh72.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.BuymfBAo.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.BNIaCSfG.js → VPLocalSearchBox.Bk6EWpPj.js} +1 -1
- package/dist/docs/assets/chunks/{theme.B47GzJjc.js → theme.Bz9AodBA.js} +2 -2
- package/dist/docs/assets/{example-agents_fsd.md.DPz9ezO4.js → example-agents_fsd.md.ZeGEpAw_.js} +2 -2
- package/dist/docs/assets/{example-agents_fsd.md.DPz9ezO4.lean.js → example-agents_fsd.md.ZeGEpAw_.lean.js} +1 -1
- package/dist/docs/assets/{example-agents_security-reviewer.md.Dkf1gyo6.js → example-agents_security-reviewer.md.DBL1TwtP.js} +2 -2
- package/dist/docs/assets/{example-agents_security-reviewer.md.Dkf1gyo6.lean.js → example-agents_security-reviewer.md.DBL1TwtP.lean.js} +1 -1
- package/dist/docs/assets/guides_convert-automation.md.BhMzTkE5.js +12 -0
- package/dist/docs/assets/guides_convert-automation.md.BhMzTkE5.lean.js +1 -0
- package/dist/docs/assets/{guides_github.md.B8QKtIpw.js → guides_github.md.CLLQJKRB.js} +4 -4
- package/dist/docs/assets/{guides_github.md.B8QKtIpw.lean.js → guides_github.md.CLLQJKRB.lean.js} +1 -1
- package/dist/docs/assets/index.md.DhRHS_-L.js +5 -0
- package/dist/docs/assets/{index.md.COeoSkcF.lean.js → index.md.DhRHS_-L.lean.js} +1 -1
- package/dist/docs/assets/{reference_cli.md.-V6J7Cl8.js → reference_cli.md.Cl14Jfo3.js} +10 -2
- package/dist/docs/assets/{reference_cli.md.-V6J7Cl8.lean.js → reference_cli.md.Cl14Jfo3.lean.js} +1 -1
- package/dist/docs/assets/scaffolding-agents.md.CrWSA0Ko.js +1 -0
- package/dist/docs/assets/{scaffolding-agents.md.mkc3B_ZW.lean.js → scaffolding-agents.md.CrWSA0Ko.lean.js} +1 -1
- package/dist/docs/assets/templates_agentic-owners.md.BkTLORaU.js +14 -0
- package/dist/docs/assets/templates_agentic-owners.md.BkTLORaU.lean.js +1 -0
- package/dist/docs/assets/templates_demo.md.Bgd6MBaZ.js +4 -0
- package/dist/docs/assets/templates_demo.md.Bgd6MBaZ.lean.js +1 -0
- package/dist/docs/assets/templates_pr-autofixer.md.DcmoeUNZ.js +8 -0
- package/dist/docs/assets/templates_pr-autofixer.md.DcmoeUNZ.lean.js +1 -0
- package/dist/docs/assets/templates_security-reviewer.md.C0yIUaYs.js +2 -0
- package/dist/docs/assets/templates_security-reviewer.md.C0yIUaYs.lean.js +1 -0
- package/dist/docs/assets/templates_triage.md.DWuQ1bZz.js +9 -0
- package/dist/docs/assets/templates_triage.md.DWuQ1bZz.lean.js +1 -0
- package/dist/docs/building-with-agents.html +4 -4
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/deployment.html +4 -4
- package/dist/docs/evals.html +4 -4
- package/dist/docs/example-agents/approval-buddy.html +4 -4
- package/dist/docs/example-agents/benny.html +4 -4
- package/dist/docs/example-agents/bugbot.html +4 -4
- package/dist/docs/example-agents/codebase-wiki.html +4 -4
- package/dist/docs/example-agents/codeowners-review.html +4 -4
- package/dist/docs/example-agents/concierge.html +4 -4
- package/dist/docs/example-agents/fsd.html +5 -5
- package/dist/docs/example-agents/index.html +4 -4
- package/dist/docs/example-agents/knowledge-base.html +4 -4
- package/dist/docs/example-agents/oncall.html +4 -4
- package/dist/docs/example-agents/security-reviewer.html +5 -5
- package/dist/docs/example-agents/slack-agent.html +4 -4
- package/dist/docs/example-agents/weather-agent.html +4 -4
- package/dist/docs/guides/agent-to-agent.html +4 -4
- package/dist/docs/guides/cloud-runtime.html +4 -4
- package/dist/docs/guides/convert-automation.html +36 -0
- package/dist/docs/guides/github.html +7 -7
- package/dist/docs/guides/human-in-the-loop.html +4 -4
- package/dist/docs/guides/mcp-oauth.html +4 -4
- package/dist/docs/guides/opentelemetry.html +4 -4
- package/dist/docs/guides/slack.html +4 -4
- package/dist/docs/guides/webhooks.html +4 -4
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +4 -4
- package/dist/docs/index.html +6 -6
- package/dist/docs/quickstart.html +4 -4
- package/dist/docs/reference/agent-config.html +4 -4
- package/dist/docs/reference/artifacts.html +4 -4
- package/dist/docs/reference/channels.html +4 -4
- package/dist/docs/reference/cli.html +14 -6
- package/dist/docs/reference/connections.html +4 -4
- package/dist/docs/reference/hooks.html +4 -4
- package/dist/docs/reference/http-api.html +4 -4
- package/dist/docs/reference/instructions.html +4 -4
- package/dist/docs/reference/playground.html +4 -4
- package/dist/docs/reference/project-layout.html +4 -4
- package/dist/docs/reference/prompt.html +4 -4
- package/dist/docs/reference/schedules.html +4 -4
- package/dist/docs/reference/sessions.html +4 -4
- package/dist/docs/reference/skills.html +4 -4
- package/dist/docs/reference/subagents.html +4 -4
- package/dist/docs/reference/tools.html +4 -4
- package/dist/docs/scaffolding-agents.html +5 -5
- package/dist/docs/storage.html +4 -4
- package/dist/docs/templates/agentic-owners.html +38 -0
- package/dist/docs/templates/demo.html +28 -0
- package/dist/docs/templates/pr-autofixer.html +32 -0
- package/dist/docs/templates/security-reviewer.html +26 -0
- package/dist/docs/templates/triage.html +14 -16
- package/dist/docs/troubleshooting.html +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/internal/cli-ax.d.ts +2 -0
- package/dist/internal/cli-ax.d.ts.map +1 -1
- package/dist/internal/cli-ax.js +30 -1
- package/dist/internal/cli-deploy.js +1 -1
- package/dist/internal/cli-slack.d.ts +4 -0
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +46 -20
- package/dist/internal/cursor-event-relay.d.ts +59 -11
- package/dist/internal/cursor-event-relay.d.ts.map +1 -1
- package/dist/internal/cursor-event-relay.js +133 -26
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +11 -2
- package/dist/internal/distribution.d.ts.map +1 -1
- package/dist/internal/distribution.js +1 -0
- package/dist/internal/handleAgentServeTrigger.d.ts +33 -6
- package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -1
- package/dist/internal/handleAgentServeTrigger.js +97 -19
- package/dist/internal/init-interview.d.ts +67 -0
- package/dist/internal/init-interview.d.ts.map +1 -0
- package/dist/internal/init-interview.js +300 -0
- package/dist/internal/init-project.d.ts +7 -0
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +99 -43
- package/dist/internal/mcp-endpoint.d.ts +7 -0
- package/dist/internal/mcp-endpoint.d.ts.map +1 -1
- package/dist/internal/mcp-endpoint.js +7 -0
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +159 -57
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +20 -21
- package/dist/internal/session-links.d.ts +14 -0
- package/dist/internal/session-links.d.ts.map +1 -0
- package/dist/internal/session-links.js +69 -0
- package/dist/internal/sessions-client.d.ts.map +1 -1
- package/dist/internal/sessions-client.js +1 -0
- package/dist/internal/slack-provision-client.js +1 -1
- package/dist/playground/assets/index-ClbuaLpm.css +1 -0
- package/dist/playground/assets/index-SqkR13k_.js +85 -0
- package/dist/playground/index.html +2 -2
- package/dist/types.d.ts +19 -12
- package/dist/types.d.ts.map +1 -1
- package/docs/README.md +15 -0
- package/docs/example-agents/fsd.md +3 -0
- package/docs/example-agents/security-reviewer.md +3 -0
- package/docs/guides/convert-automation.md +176 -0
- package/docs/guides/github.md +6 -2
- package/docs/reference/cli.md +36 -10
- package/docs/scaffolding-agents.md +3 -0
- package/docs/templates/agentic-owners.md +97 -0
- package/docs/templates/demo.md +84 -0
- package/docs/templates/pr-autofixer.md +136 -0
- package/docs/templates/security-reviewer.md +89 -0
- package/docs/templates/triage.md +59 -101
- package/package.json +9 -1
- package/skills/github/SKILL.md +4 -5
- package/src/bin/agent-serve.ts +13 -6
- package/src/channels/github/github-channel.ts +95 -18
- package/src/channels/github/types.ts +31 -0
- package/src/channels/origin/cursor-account.ts +64 -0
- package/src/channels/origin/events.ts +41 -0
- package/src/channels/origin/index.ts +29 -0
- package/src/channels/origin/origin-channel.ts +784 -0
- package/src/channels/origin/origin-webhook.ts +202 -0
- package/src/channels/origin/types.ts +186 -0
- package/src/channels/slack/doctor.ts +218 -5
- package/src/index.ts +3 -1
- package/src/internal/cli-ax.ts +33 -1
- package/src/internal/cli-deploy.ts +2 -2
- package/src/internal/cli-slack.ts +68 -19
- package/src/internal/cursor-event-relay.ts +193 -31
- package/src/internal/discovery.ts +15 -5
- package/src/internal/distribution.ts +1 -0
- package/src/internal/handleAgentServeTrigger.ts +129 -19
- package/src/internal/init-interview.ts +384 -0
- package/src/internal/init-project.ts +146 -46
- package/src/internal/mcp-endpoint.ts +7 -0
- package/src/internal/server.ts +188 -58
- package/src/internal/session-engine.ts +5 -21
- package/src/internal/session-links.ts +88 -0
- package/src/internal/sessions-client.ts +1 -0
- package/src/internal/slack-provision-client.ts +1 -1
- package/src/types.ts +19 -12
- package/templates/agentic-owners/README.md +73 -0
- package/templates/agentic-owners/agent/agent.ts +15 -0
- package/templates/agentic-owners/agent/channels/github.ts +85 -0
- package/templates/agentic-owners/agent/instructions.md +34 -0
- package/templates/agentic-owners/agent/lib/config.ts +13 -0
- package/templates/agentic-owners/agent/lib/github.ts +241 -0
- package/templates/agentic-owners/agent/lib/owners/README.md +50 -0
- package/templates/agentic-owners/agent/lib/owners/constants.ts +22 -0
- package/templates/agentic-owners/agent/lib/owners/decision.ts +485 -0
- package/templates/agentic-owners/agent/lib/owners/handles.ts +54 -0
- package/templates/agentic-owners/agent/lib/owners/match.ts +177 -0
- package/templates/agentic-owners/agent/lib/owners/matching.ts +95 -0
- package/templates/agentic-owners/agent/lib/owners/parse.ts +589 -0
- package/templates/agentic-owners/agent/lib/owners/policyMode.ts +65 -0
- package/templates/agentic-owners/agent/lib/owners/prompt.ts +66 -0
- package/templates/agentic-owners/agent/lib/owners/prompts/base-review.md +105 -0
- package/templates/agentic-owners/agent/lib/owners/types.ts +45 -0
- package/templates/agentic-owners/agent/lib/review.ts +777 -0
- package/templates/agentic-owners/agent/tools/record_review.ts +69 -0
- package/templates/agentic-owners/evals/evals.config.ts +5 -0
- package/templates/agentic-owners/evals/owners.eval.ts +116 -0
- package/templates/agentic-owners/package.json +20 -0
- package/templates/agentic-owners/tsconfig.json +12 -0
- package/templates/demo/README.md +33 -0
- package/templates/demo/agent/agent.ts +15 -0
- package/templates/demo/agent/channels/github.ts +50 -0
- package/templates/demo/agent/channels/queue.ts +30 -0
- package/templates/demo/agent/instructions.md +8 -0
- package/templates/demo/agent/lib/collect.ts +78 -0
- package/templates/demo/agent/tools/record_demo.ts +40 -0
- package/templates/demo/evals/demo.eval.ts +33 -0
- package/templates/demo/evals/evals.config.ts +5 -0
- package/templates/demo/package.json +18 -0
- package/templates/demo/tsconfig.json +12 -0
- package/templates/pr-autofixer/README.md +44 -0
- package/templates/pr-autofixer/agent/agent.ts +22 -0
- package/templates/pr-autofixer/agent/channels/drive.ts +40 -0
- package/templates/pr-autofixer/agent/channels/github.ts +167 -0
- package/templates/pr-autofixer/agent/channels/slack.ts +17 -0
- package/templates/pr-autofixer/agent/hooks/bind-agent.ts +19 -0
- package/templates/pr-autofixer/agent/instructions.md +83 -0
- package/templates/pr-autofixer/agent/lib/affinity.ts +33 -0
- package/templates/pr-autofixer/agent/lib/drive-schemas.ts +15 -0
- package/templates/pr-autofixer/agent/lib/drive.ts +79 -0
- package/templates/pr-autofixer/agent/lib/merge-watch.ts +123 -0
- package/templates/pr-autofixer/agent/lib/pr-state.ts +54 -0
- package/templates/pr-autofixer/agent/lib/repos.ts +19 -0
- package/templates/pr-autofixer/agent/lib/start-drive.ts +122 -0
- package/templates/pr-autofixer/agent/lib/webhook-buffer.ts +225 -0
- package/templates/pr-autofixer/agent/lib/webhook-routing.ts +231 -0
- package/templates/pr-autofixer/agent/storage.ts +7 -0
- package/templates/pr-autofixer/agent/tools/drive_pr.ts +22 -0
- package/templates/pr-autofixer/evals/coordinator.eval.ts +16 -0
- package/templates/pr-autofixer/evals/evals.config.ts +5 -0
- package/templates/pr-autofixer/init.json +25 -0
- package/templates/pr-autofixer/package.json +18 -0
- package/templates/pr-autofixer/tsconfig.json +12 -0
- package/templates/security-reviewer/README.md +31 -0
- package/templates/security-reviewer/agent/agent.ts +15 -0
- package/templates/security-reviewer/agent/channels/github.ts +46 -0
- package/templates/security-reviewer/agent/instructions.md +22 -0
- package/templates/security-reviewer/agent/lib/repos.ts +5 -0
- package/templates/security-reviewer/agent/tools/post_findings.ts +72 -0
- package/templates/security-reviewer/evals/evals.config.ts +5 -0
- package/templates/security-reviewer/evals/review.eval.ts +53 -0
- package/templates/security-reviewer/init.json +25 -0
- package/templates/security-reviewer/package.json +18 -0
- package/templates/security-reviewer/tsconfig.json +12 -0
- package/templates/triage/README.md +27 -29
- package/templates/triage/agent/agent.ts +1 -0
- package/templates/triage/agent/channels/queue.ts +47 -0
- package/templates/triage/agent/channels/webhook.ts +50 -0
- package/templates/triage/agent/instructions.md +24 -13
- package/templates/triage/agent/lib/actuate.ts +759 -0
- package/templates/triage/agent/lib/parse-queue-event.ts +168 -0
- package/templates/triage/agent/lib/tracker.ts +5 -0
- package/templates/triage/agent/lib/types.ts +52 -0
- package/templates/triage/agent/lib/verify-webhook.ts +81 -0
- package/templates/triage/agent/skills/triage-rubric.md +6 -5
- package/templates/triage/agent/tools/record_triage.ts +24 -5
- package/templates/triage/evals/triage.eval.ts +25 -3
- package/templates/triage/overlays/jira/README.md +21 -0
- package/templates/triage/overlays/jira/agent/lib/tracker.ts +8 -0
- package/templates/triage/overlays/jira/agent/mcp-connections/tracker.ts +7 -0
- package/templates/triage/overlays/linear/README.md +21 -0
- package/templates/triage/overlays/linear/agent/lib/tracker.ts +8 -0
- package/templates/triage/overlays/linear/agent/mcp-connections/tracker.ts +7 -0
- package/templates/triage/package.json +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.C4uxzYEU.js +0 -1
- package/dist/docs/assets/index.md.COeoSkcF.js +0 -5
- package/dist/docs/assets/scaffolding-agents.md.mkc3B_ZW.js +0 -1
- package/dist/docs/assets/templates_triage.md.CConZt1z.js +0 -11
- package/dist/docs/assets/templates_triage.md.CConZt1z.lean.js +0 -1
- package/dist/playground/assets/index-BHAPd9KT.js +0 -85
- package/dist/playground/assets/index-DpKH0HcT.css +0 -1
- package/templates/triage/agent/channels/intake.ts +0 -20
- package/templates/triage/agent/channels/slack.ts +0 -3
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import type { HostGitHubClient } from "@cursor/july";
|
|
2
|
+
|
|
3
|
+
export interface PrRef {
|
|
4
|
+
owner: string;
|
|
5
|
+
repo: string;
|
|
6
|
+
number: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface PullRequestSnapshot {
|
|
10
|
+
number: number;
|
|
11
|
+
state: "open" | "closed";
|
|
12
|
+
merged: boolean;
|
|
13
|
+
headSha: string;
|
|
14
|
+
baseRef: string;
|
|
15
|
+
authorLogin?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Total changed files GitHub reports for the PR. Compared against the
|
|
18
|
+
* `listChangedFiles` result: the list API caps at 3000 files, and paths
|
|
19
|
+
* it omits would otherwise never enter policy matching or the evidence
|
|
20
|
+
* hold.
|
|
21
|
+
*/
|
|
22
|
+
changedFilesCount: number;
|
|
23
|
+
/** Users as bare logins, teams as `owner/slug`. */
|
|
24
|
+
requestedReviewers: string[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ChangedFile {
|
|
28
|
+
filename: string;
|
|
29
|
+
status: string;
|
|
30
|
+
previousFilename?: string;
|
|
31
|
+
patch?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PrReview {
|
|
35
|
+
id: number;
|
|
36
|
+
state: string;
|
|
37
|
+
body: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface PrComment {
|
|
41
|
+
id: number;
|
|
42
|
+
body: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Everything the review pipeline needs from GitHub, bound to one PR. The
|
|
47
|
+
* pipeline stays testable against a fake; this file owns the octokit calls.
|
|
48
|
+
*/
|
|
49
|
+
export interface OwnersForge {
|
|
50
|
+
ref: PrRef;
|
|
51
|
+
getPullRequest(): Promise<PullRequestSnapshot>;
|
|
52
|
+
listChangedFiles(): Promise<ChangedFile[]>;
|
|
53
|
+
/** Fetch file contents at a ref; absent paths are simply omitted. */
|
|
54
|
+
readFilesAtRef(
|
|
55
|
+
ref: string,
|
|
56
|
+
paths: readonly string[]
|
|
57
|
+
): Promise<Map<string, string>>;
|
|
58
|
+
requestReviewers(input: { users: string[]; teams: string[] }): Promise<void>;
|
|
59
|
+
/** Submit an APPROVE review pinned to `commitId` (never the live head). */
|
|
60
|
+
submitApproval(input: { body: string; commitId: string }): Promise<void>;
|
|
61
|
+
/** Dismiss a previously submitted approval (e.g. after a base retarget). */
|
|
62
|
+
dismissApproval(input: { reviewId: number; message: string }): Promise<void>;
|
|
63
|
+
listReviews(): Promise<PrReview[]>;
|
|
64
|
+
listComments(): Promise<PrComment[]>;
|
|
65
|
+
createComment(body: string): Promise<void>;
|
|
66
|
+
updateComment(id: number, body: string): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function isNotFound(error: unknown): boolean {
|
|
70
|
+
return (
|
|
71
|
+
typeof error === "object" &&
|
|
72
|
+
error !== null &&
|
|
73
|
+
"status" in error &&
|
|
74
|
+
error.status === 404
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function githubOwnersForge(
|
|
79
|
+
github: HostGitHubClient,
|
|
80
|
+
ref: PrRef
|
|
81
|
+
): OwnersForge {
|
|
82
|
+
const repo = { owner: ref.owner, repo: ref.repo };
|
|
83
|
+
return {
|
|
84
|
+
ref,
|
|
85
|
+
|
|
86
|
+
async getPullRequest(): Promise<PullRequestSnapshot> {
|
|
87
|
+
const octokit = await github.getOctokit();
|
|
88
|
+
const { data } = await octokit.rest.pulls.get({
|
|
89
|
+
...repo,
|
|
90
|
+
pull_number: ref.number,
|
|
91
|
+
});
|
|
92
|
+
const requestedUsers = (data.requested_reviewers ?? []).flatMap(
|
|
93
|
+
(reviewer) => ("login" in reviewer ? [reviewer.login] : [])
|
|
94
|
+
);
|
|
95
|
+
const requestedTeams = (data.requested_teams ?? []).map(
|
|
96
|
+
(team) => `${ref.owner}/${team.slug}`
|
|
97
|
+
);
|
|
98
|
+
return {
|
|
99
|
+
number: data.number,
|
|
100
|
+
state: data.state === "closed" ? "closed" : "open",
|
|
101
|
+
merged: data.merged === true,
|
|
102
|
+
headSha: data.head.sha,
|
|
103
|
+
baseRef: data.base.ref,
|
|
104
|
+
authorLogin: data.user?.login,
|
|
105
|
+
changedFilesCount: data.changed_files,
|
|
106
|
+
requestedReviewers: [...requestedUsers, ...requestedTeams],
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
async listChangedFiles(): Promise<ChangedFile[]> {
|
|
111
|
+
const octokit = await github.getOctokit();
|
|
112
|
+
const files = await octokit.paginate(octokit.rest.pulls.listFiles, {
|
|
113
|
+
...repo,
|
|
114
|
+
pull_number: ref.number,
|
|
115
|
+
per_page: 100,
|
|
116
|
+
});
|
|
117
|
+
return files.map((file) => ({
|
|
118
|
+
filename: file.filename,
|
|
119
|
+
status: file.status,
|
|
120
|
+
previousFilename: file.previous_filename,
|
|
121
|
+
patch: file.patch,
|
|
122
|
+
}));
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
async readFilesAtRef(
|
|
126
|
+
gitRef: string,
|
|
127
|
+
paths: readonly string[]
|
|
128
|
+
): Promise<Map<string, string>> {
|
|
129
|
+
const octokit = await github.getOctokit();
|
|
130
|
+
const found = new Map<string, string>();
|
|
131
|
+
for (const path of paths) {
|
|
132
|
+
let data: unknown;
|
|
133
|
+
try {
|
|
134
|
+
({ data } = await octokit.rest.repos.getContent({
|
|
135
|
+
...repo,
|
|
136
|
+
path,
|
|
137
|
+
ref: gitRef,
|
|
138
|
+
}));
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (isNotFound(error)) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
throw error;
|
|
144
|
+
}
|
|
145
|
+
if (typeof data !== "object" || data === null || Array.isArray(data)) {
|
|
146
|
+
continue; // directory listing — not a file
|
|
147
|
+
}
|
|
148
|
+
const file = data as { content?: string; encoding?: string };
|
|
149
|
+
if (file.encoding !== "base64" || typeof file.content !== "string") {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
found.set(path, Buffer.from(file.content, "base64").toString("utf8"));
|
|
153
|
+
}
|
|
154
|
+
return found;
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
async requestReviewers(input: {
|
|
158
|
+
users: string[];
|
|
159
|
+
teams: string[];
|
|
160
|
+
}): Promise<void> {
|
|
161
|
+
const octokit = await github.getOctokit();
|
|
162
|
+
await octokit.rest.pulls.requestReviewers({
|
|
163
|
+
...repo,
|
|
164
|
+
pull_number: ref.number,
|
|
165
|
+
reviewers: input.users,
|
|
166
|
+
team_reviewers: input.teams,
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
async submitApproval(input: {
|
|
171
|
+
body: string;
|
|
172
|
+
commitId: string;
|
|
173
|
+
}): Promise<void> {
|
|
174
|
+
const octokit = await github.getOctokit();
|
|
175
|
+
await octokit.rest.pulls.createReview({
|
|
176
|
+
...repo,
|
|
177
|
+
pull_number: ref.number,
|
|
178
|
+
commit_id: input.commitId,
|
|
179
|
+
event: "APPROVE",
|
|
180
|
+
body: input.body,
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
async dismissApproval(input: {
|
|
185
|
+
reviewId: number;
|
|
186
|
+
message: string;
|
|
187
|
+
}): Promise<void> {
|
|
188
|
+
const octokit = await github.getOctokit();
|
|
189
|
+
await octokit.rest.pulls.dismissReview({
|
|
190
|
+
...repo,
|
|
191
|
+
pull_number: ref.number,
|
|
192
|
+
review_id: input.reviewId,
|
|
193
|
+
message: input.message,
|
|
194
|
+
});
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
async listReviews(): Promise<PrReview[]> {
|
|
198
|
+
const octokit = await github.getOctokit();
|
|
199
|
+
const reviews = await octokit.paginate(octokit.rest.pulls.listReviews, {
|
|
200
|
+
...repo,
|
|
201
|
+
pull_number: ref.number,
|
|
202
|
+
per_page: 100,
|
|
203
|
+
});
|
|
204
|
+
return reviews.map((review) => ({
|
|
205
|
+
id: review.id,
|
|
206
|
+
state: review.state,
|
|
207
|
+
body: review.body ?? "",
|
|
208
|
+
}));
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
async listComments(): Promise<PrComment[]> {
|
|
212
|
+
const octokit = await github.getOctokit();
|
|
213
|
+
const comments = await octokit.paginate(
|
|
214
|
+
octokit.rest.issues.listComments,
|
|
215
|
+
{ ...repo, issue_number: ref.number, per_page: 100 }
|
|
216
|
+
);
|
|
217
|
+
return comments.map((comment) => ({
|
|
218
|
+
id: comment.id,
|
|
219
|
+
body: comment.body ?? "",
|
|
220
|
+
}));
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
async createComment(body: string): Promise<void> {
|
|
224
|
+
const octokit = await github.getOctokit();
|
|
225
|
+
await octokit.rest.issues.createComment({
|
|
226
|
+
...repo,
|
|
227
|
+
issue_number: ref.number,
|
|
228
|
+
body,
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
async updateComment(id: number, body: string): Promise<void> {
|
|
233
|
+
const octokit = await github.getOctokit();
|
|
234
|
+
await octokit.rest.issues.updateComment({
|
|
235
|
+
...repo,
|
|
236
|
+
comment_id: id,
|
|
237
|
+
body,
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Vendored Agentic Owners policy core
|
|
2
|
+
|
|
3
|
+
This directory is the policy core of Cursor's Agentic Owners: the
|
|
4
|
+
`.agentic-owners/policy.yml` schema, CODEOWNERS-style path matching with
|
|
5
|
+
closest-policy precedence, and the deterministic approval decision. It is
|
|
6
|
+
vendored from the internal source (`packages/agentic-owners`, via the hosted
|
|
7
|
+
agent's fork in `factory/agentic-owners/agent/lib/owners/`) so a scaffolded
|
|
8
|
+
project installs from this directory alone.
|
|
9
|
+
|
|
10
|
+
Parsing, matching, and precedence semantics for the committed policy files
|
|
11
|
+
this template reads must stay identical to the source; `decideApproval`
|
|
12
|
+
keeps the source's policy rules and adds the fail-closes listed below. Edit
|
|
13
|
+
`prompts/base-review.md` freely (it is your risk rubric); change the `.ts`
|
|
14
|
+
files only if you accept drifting from upstream.
|
|
15
|
+
|
|
16
|
+
Deliberate divergences from the source (generalizations for use outside the
|
|
17
|
+
Cursor monorepo, or fail-closed tightenings — never approve-more changes):
|
|
18
|
+
|
|
19
|
+
- No hardcoded GitHub org: bare `team:` slugs stay bare and resolve against
|
|
20
|
+
the watched repository's owner at actuation. The Canon-specific
|
|
21
|
+
`<slug>-reviewers` convention, team-handle probing, and the Graphite
|
|
22
|
+
mention-sentinel repair are dropped.
|
|
23
|
+
- The default-fallback auto-approve calibration (`fallbackRiskAutoApproves`,
|
|
24
|
+
Statsig-tuned) is dropped: unowned changes go through the same
|
|
25
|
+
`decideApproval` path, so only Very Low / Low risk auto-approves.
|
|
26
|
+
- Reply-text verdict parsing (`parseReviewResult`) is dropped: the model
|
|
27
|
+
records its verdict through the `record_review` tool instead.
|
|
28
|
+
- `delegated_automations` (Cursor-automation approvals satisfying a rule) is
|
|
29
|
+
rejected at parse time instead of validated-and-ignored: nothing in this
|
|
30
|
+
template consumes automation approvals.
|
|
31
|
+
- Team membership is never resolved (repo-scoped credentials cannot read
|
|
32
|
+
org teams), so `self_review` lifts apply only to `user:` owners; team
|
|
33
|
+
ownership stays fail-closed for the author, the source's posture when
|
|
34
|
+
membership is unresolved. `ApprovalAuthor` accordingly carries no
|
|
35
|
+
`teamSlugs`.
|
|
36
|
+
- The CI-gate merge fields (`approvalTeams` / `approvalUsers` /
|
|
37
|
+
`approvalMode`) and the runtime CODEOWNERS→policy bridge (`isGenerated`,
|
|
38
|
+
its precedence carve-outs, and the empty-generated-shim allowance) are
|
|
39
|
+
dropped: this agent never reads `.agentic-owners/generated/` and consumes
|
|
40
|
+
none of the gate internals.
|
|
41
|
+
- Medium+ `self_review` requires the author's authority to cover EVERY
|
|
42
|
+
review-capable matched rule (`self_review` clears *that rule*; one owned
|
|
43
|
+
rule must not stamp a PR whose other matched rules still require review).
|
|
44
|
+
- The host fail-closes live inside `decideApproval` (`evidence` +
|
|
45
|
+
`governanceTouch` inputs): a governance touch or incomplete evidence
|
|
46
|
+
(empty / truncated diff, capped file list) downgrades a would-be approve
|
|
47
|
+
to requesting reviewers, so actuation only writes the returned decision.
|
|
48
|
+
- `prompts/base-review.md` is a generic rewrite of the source rubric with
|
|
49
|
+
the Cursor-repo region overrides removed. The security posture
|
|
50
|
+
(adversarial PR content, the policy self-modification guard) is kept.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Vendored from the Agentic Owners policy core; see README.md in this
|
|
2
|
+
// directory. Values must stay identical to the source's, except the source's
|
|
3
|
+
// `CURSOR_GITHUB_ORG` constant: this template resolves bare team slugs
|
|
4
|
+
// against the watched repository's owner instead of a hardcoded org.
|
|
5
|
+
|
|
6
|
+
export const AGENTIC_OWNERS_DIR = ".agentic-owners";
|
|
7
|
+
|
|
8
|
+
export const AGENTIC_OWNERS_POLICY_FILE = "policy.yml";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Directory (under {@link AGENTIC_OWNERS_DIR}) for machine-generated policy
|
|
12
|
+
* files produced at review time (e.g. a CODEOWNERS → policy bridge). Never
|
|
13
|
+
* committed; always excluded from the agent's changed-file set.
|
|
14
|
+
*/
|
|
15
|
+
export const AGENTIC_OWNERS_GENERATED_DIR: `${typeof AGENTIC_OWNERS_DIR}/generated` = `${AGENTIC_OWNERS_DIR}/generated`;
|
|
16
|
+
|
|
17
|
+
/** The root policy file — the only place `global_exclusions` is allowed. */
|
|
18
|
+
export const ROOT_POLICY_SOURCE_PATH = ".agentic-owners/policy.yml";
|
|
19
|
+
|
|
20
|
+
export const AGENTIC_OWNERS_CONFIG_VERSION = 1;
|
|
21
|
+
|
|
22
|
+
export const AGENTIC_OWNERS_MAX_COMPOSED_PROMPT_CHARS = 120_000;
|