@cursor/july 0.1.62 → 0.1.73
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/AGENTS.md +4 -5
- package/README.md +23 -11
- package/dist/bin/agent-serve.js +11 -2
- package/dist/channels/github/api.d.ts +2 -0
- package/dist/channels/github/api.d.ts.map +1 -1
- package/dist/channels/github/api.js +2 -1
- package/dist/channels/github/binding.d.ts +7 -0
- package/dist/channels/github/binding.d.ts.map +1 -1
- package/dist/channels/github/binding.js +4 -0
- package/dist/channels/github/checks.d.ts +99 -0
- package/dist/channels/github/checks.d.ts.map +1 -0
- package/dist/channels/github/checks.js +108 -0
- package/dist/channels/github/cursor-account.d.ts +4 -4
- package/dist/channels/github/cursor-account.d.ts.map +1 -1
- package/dist/channels/github/cursor-account.js +7 -5
- package/dist/channels/github/index.d.ts +1 -0
- package/dist/channels/github/index.d.ts.map +1 -1
- package/dist/channels/github/index.js +1 -0
- package/dist/channels/github/types.d.ts +8 -0
- package/dist/channels/github/types.d.ts.map +1 -1
- package/dist/channels/slack/channel-watch.d.ts +2 -1
- package/dist/channels/slack/channel-watch.d.ts.map +1 -1
- package/dist/channels/slack/channel-watch.js +7 -3
- package/dist/channels/slack/dispatch.d.ts +9 -0
- package/dist/channels/slack/dispatch.d.ts.map +1 -1
- package/dist/channels/slack/dispatch.js +41 -21
- package/dist/channels/slack/manifest.d.ts +2 -2
- package/dist/channels/slack/manifest.d.ts.map +1 -1
- package/dist/channels/slack/manifest.js +14 -11
- package/dist/channels/slack/nudge-store.d.ts +16 -0
- package/dist/channels/slack/nudge-store.d.ts.map +1 -1
- package/dist/channels/slack/nudge-store.js +53 -0
- package/dist/channels/slack/slack-channel.d.ts.map +1 -1
- package/dist/channels/slack/slack-channel.js +4 -1
- package/dist/channels/slack/types.d.ts +24 -7
- package/dist/channels/slack/types.d.ts.map +1 -1
- package/dist/connections.d.ts +17 -5
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +17 -5
- package/dist/docs/404.html +2 -2
- package/dist/docs/ab.html +3 -3
- package/dist/docs/assets/{app.B-biogkN.js → app.CdbcFD8T.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DQad--_z.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.DZqKtFZS.js → VPLocalSearchBox.D_NKImM7.js} +1 -1
- package/dist/docs/assets/chunks/{theme.BwC5zP2r.js → theme.CMvz7cu9.js} +2 -2
- package/dist/docs/assets/{concepts.md.CqOsxbMU.js → concepts.md.BXAm6G-C.js} +1 -1
- package/dist/docs/assets/{guides_mcp-oauth.md.C7G7IykG.js → guides_mcp-oauth.md.CzEB6RaG.js} +1 -1
- package/dist/docs/assets/{reference_agent-config.md.DHkkvcEZ.js → reference_agent-config.md.BZnEKfEc.js} +3 -4
- package/dist/docs/assets/{reference_agent-config.md.DHkkvcEZ.lean.js → reference_agent-config.md.BZnEKfEc.lean.js} +1 -1
- package/dist/docs/assets/{reference_connections.md.CSQiNzre.js → reference_connections.md.Cu3N-S3Q.js} +26 -9
- package/dist/docs/assets/reference_connections.md.Cu3N-S3Q.lean.js +1 -0
- package/dist/docs/assets/{reference_sessions.md.DBVFi2Sx.js → reference_sessions.md.B0DdlM-K.js} +1 -1
- package/dist/docs/assets/{reference_tools.md.kJfJAP2m.js → reference_tools.md.DTg_kEsx.js} +2 -2
- package/dist/docs/assets/{reference_tools.md.kJfJAP2m.lean.js → reference_tools.md.DTg_kEsx.lean.js} +1 -1
- package/dist/docs/assets/troubleshooting.md.DQ-hYuZT.js +1 -0
- package/dist/docs/building-with-agents.html +3 -3
- package/dist/docs/concepts.html +5 -5
- package/dist/docs/deployment.html +3 -3
- package/dist/docs/evals.html +3 -3
- package/dist/docs/example-agents/approval-buddy.html +3 -3
- package/dist/docs/example-agents/benny.html +3 -3
- package/dist/docs/example-agents/bugbot.html +3 -3
- package/dist/docs/example-agents/codebase-wiki.html +3 -3
- package/dist/docs/example-agents/codeowners-review.html +3 -3
- package/dist/docs/example-agents/concierge.html +3 -3
- package/dist/docs/example-agents/fsd.html +3 -3
- package/dist/docs/example-agents/index.html +3 -3
- package/dist/docs/example-agents/knowledge-base.html +3 -3
- package/dist/docs/example-agents/oncall.html +3 -3
- package/dist/docs/example-agents/security-reviewer.html +3 -3
- package/dist/docs/example-agents/slack-agent.html +3 -3
- package/dist/docs/example-agents/weather-agent.html +3 -3
- package/dist/docs/guides/agent-to-agent.html +3 -3
- package/dist/docs/guides/cloud-runtime.html +3 -3
- package/dist/docs/guides/convert-automation.html +3 -3
- package/dist/docs/guides/github.html +3 -3
- package/dist/docs/guides/human-in-the-loop.html +3 -3
- package/dist/docs/guides/mcp-oauth.html +5 -5
- package/dist/docs/guides/opentelemetry.html +3 -3
- package/dist/docs/guides/slack.html +3 -3
- package/dist/docs/guides/webhooks.html +3 -3
- package/dist/docs/hashmap.json +1 -1
- package/dist/docs/hillclimbing.html +3 -3
- package/dist/docs/index.html +3 -3
- package/dist/docs/quickstart.html +3 -3
- package/dist/docs/reference/agent-config.html +5 -6
- package/dist/docs/reference/artifacts.html +3 -3
- package/dist/docs/reference/channels.html +3 -3
- package/dist/docs/reference/cli.html +3 -3
- package/dist/docs/reference/connections.html +28 -11
- package/dist/docs/reference/hooks.html +3 -3
- package/dist/docs/reference/http-api.html +3 -3
- package/dist/docs/reference/instructions.html +3 -3
- package/dist/docs/reference/playground.html +3 -3
- package/dist/docs/reference/project-layout.html +3 -3
- package/dist/docs/reference/prompt.html +3 -3
- package/dist/docs/reference/schedules.html +3 -3
- package/dist/docs/reference/sessions.html +5 -5
- package/dist/docs/reference/skills.html +3 -3
- package/dist/docs/reference/subagents.html +3 -3
- package/dist/docs/reference/tools.html +5 -5
- package/dist/docs/scaffolding-agents.html +3 -3
- package/dist/docs/storage.html +3 -3
- package/dist/docs/templates/agentic-owners.html +3 -3
- package/dist/docs/templates/demo.html +3 -3
- package/dist/docs/templates/pr-autofixer.html +3 -3
- package/dist/docs/templates/security-reviewer.html +3 -3
- package/dist/docs/templates/triage.html +3 -3
- package/dist/docs/troubleshooting.html +5 -5
- package/dist/files-backends/agent-store-presigned-url.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/advertise-tools.d.ts +79 -0
- package/dist/internal/advertise-tools.d.ts.map +1 -0
- package/dist/internal/advertise-tools.js +185 -0
- package/dist/internal/cli-deploy.d.ts.map +1 -1
- package/dist/internal/cli-deploy.js +7 -1
- package/dist/internal/cli-manifest.d.ts +19 -0
- package/dist/internal/cli-manifest.d.ts.map +1 -0
- package/dist/internal/cli-manifest.js +49 -0
- package/dist/internal/cli-slack.d.ts.map +1 -1
- package/dist/internal/cli-slack.js +9 -1
- package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -1
- package/dist/internal/convert-automation/convert-workflow.js +2 -10
- package/dist/internal/cursor/account-mcp.d.ts +29 -3
- package/dist/internal/cursor/account-mcp.d.ts.map +1 -1
- package/dist/internal/cursor/account-mcp.js +147 -67
- package/dist/internal/cursor/backend-client.d.ts +11 -6
- package/dist/internal/cursor/backend-client.d.ts.map +1 -1
- package/dist/internal/cursor/backend-client.js +32 -10
- package/dist/internal/cursor-account-mcp-auth.d.ts +11 -0
- package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -1
- package/dist/internal/cursor-account-mcp-auth.js +69 -0
- package/dist/internal/cursor-agent-template.d.ts +9 -0
- package/dist/internal/cursor-agent-template.d.ts.map +1 -0
- package/dist/internal/cursor-agent-template.js +37 -0
- package/dist/internal/deploy-client.d.ts +1 -0
- package/dist/internal/deploy-client.d.ts.map +1 -1
- package/dist/internal/deploy-client.js +18 -2
- package/dist/internal/deploy-manifest.d.ts +76 -0
- package/dist/internal/deploy-manifest.d.ts.map +1 -0
- package/dist/internal/deploy-manifest.js +117 -0
- package/dist/internal/deployment-scm-event-stream.d.ts +116 -0
- package/dist/internal/deployment-scm-event-stream.d.ts.map +1 -0
- package/dist/internal/deployment-scm-event-stream.js +474 -0
- package/dist/internal/discovery.d.ts.map +1 -1
- package/dist/internal/discovery.js +111 -10
- package/dist/internal/init-project.d.ts.map +1 -1
- package/dist/internal/init-project.js +12 -123
- package/dist/internal/init-scaffold.d.ts +8 -0
- package/dist/internal/init-scaffold.d.ts.map +1 -0
- package/dist/internal/init-scaffold.js +168 -0
- package/dist/internal/inline-stdio-mcp.d.ts +2 -0
- package/dist/internal/inline-stdio-mcp.d.ts.map +1 -1
- package/dist/internal/inline-stdio-mcp.js +10 -8
- package/dist/internal/json-schema.d.ts +7 -0
- package/dist/internal/json-schema.d.ts.map +1 -1
- package/dist/internal/json-schema.js +18 -3
- package/dist/internal/mcp-endpoint.js +7 -7
- package/dist/internal/mcp-host.d.ts +18 -0
- package/dist/internal/mcp-host.d.ts.map +1 -1
- package/dist/internal/mcp-host.js +43 -5
- package/dist/internal/mcp-oauth.d.ts +22 -0
- package/dist/internal/mcp-oauth.d.ts.map +1 -1
- package/dist/internal/mcp-oauth.js +40 -1
- package/dist/internal/package-inline-stdio.d.ts.map +1 -1
- package/dist/internal/package-inline-stdio.js +5 -5
- package/dist/internal/review-comments.d.ts +97 -0
- package/dist/internal/review-comments.d.ts.map +1 -1
- package/dist/internal/review-comments.js +151 -0
- package/dist/internal/sanitize-mcp-tool-name.d.ts +20 -0
- package/dist/internal/sanitize-mcp-tool-name.d.ts.map +1 -0
- package/dist/internal/sanitize-mcp-tool-name.js +30 -0
- package/dist/internal/sdk-runner.d.ts +1 -1
- package/dist/internal/sdk-runner.d.ts.map +1 -1
- package/dist/internal/sdk-runner.js +36 -13
- package/dist/internal/server.d.ts.map +1 -1
- package/dist/internal/server.js +18 -0
- package/dist/internal/session-engine.d.ts +66 -0
- package/dist/internal/session-engine.d.ts.map +1 -1
- package/dist/internal/session-engine.js +428 -110
- package/dist/internal/shallow-clone.d.ts +170 -0
- package/dist/internal/shallow-clone.d.ts.map +1 -0
- package/dist/internal/shallow-clone.js +412 -0
- package/dist/internal/slack-provision-client.d.ts +2 -0
- package/dist/internal/slack-provision-client.d.ts.map +1 -1
- package/dist/internal/slack-provision-client.js +1 -0
- package/dist/internal/terminal-style.d.ts +18 -0
- package/dist/internal/terminal-style.d.ts.map +1 -1
- package/dist/internal/terminal-style.js +46 -1
- package/dist/internal/turn-lease-store.d.ts +44 -0
- package/dist/internal/turn-lease-store.d.ts.map +1 -0
- package/dist/internal/turn-lease-store.js +139 -0
- package/dist/internal/workspace.d.ts +14 -0
- package/dist/internal/workspace.d.ts.map +1 -1
- package/dist/internal/workspace.js +33 -0
- package/dist/playground/assets/index-77uhu5Kr.css +1 -0
- package/dist/playground/assets/index-D4buox4m.js +85 -0
- package/dist/playground/index.html +2 -2
- package/dist/storage-protocol.d.ts +122 -0
- package/dist/storage-protocol.d.ts.map +1 -0
- package/dist/storage-protocol.js +173 -0
- package/dist/storage.d.ts +2 -72
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +2 -82
- package/dist/tools.d.ts +7 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/types.d.ts +141 -6
- package/dist/types.d.ts.map +1 -1
- package/docs/concepts.md +4 -4
- package/docs/guides/mcp-oauth.md +3 -1
- package/docs/reference/agent-config.md +11 -12
- package/docs/reference/connections.md +108 -10
- package/docs/reference/sessions.md +2 -2
- package/docs/reference/tools.md +14 -0
- package/docs/troubleshooting.md +3 -2
- package/package.json +7 -2
- package/skills/create-agent/SKILL.md +12 -9
- package/skills/debug/SKILL.md +2 -1
- package/skills/framework-map/SKILL.md +6 -6
- package/skills/mcp-auth/SKILL.md +8 -6
- package/src/bin/agent-serve.ts +12 -2
- package/src/channels/github/api.ts +6 -1
- package/src/channels/github/binding.ts +21 -0
- package/src/channels/github/checks.ts +179 -0
- package/src/channels/github/cursor-account.ts +9 -6
- package/src/channels/github/index.ts +1 -0
- package/src/channels/github/types.ts +8 -0
- package/src/channels/slack/channel-watch.ts +6 -3
- package/src/channels/slack/dispatch.ts +40 -3
- package/src/channels/slack/manifest.ts +9 -10
- package/src/channels/slack/nudge-store.ts +56 -0
- package/src/channels/slack/slack-channel.ts +3 -0
- package/src/channels/slack/types.ts +24 -7
- package/src/connections.ts +17 -5
- package/src/index.ts +5 -0
- package/src/internal/advertise-tools.ts +278 -0
- package/src/internal/cli-deploy.ts +11 -1
- package/src/internal/cli-manifest.ts +63 -0
- package/src/internal/cli-slack.ts +10 -1
- package/src/internal/convert-automation/convert-workflow.ts +2 -11
- package/src/internal/cursor/account-mcp.ts +208 -73
- package/src/internal/cursor/backend-client.ts +45 -11
- package/src/internal/cursor-account-mcp-auth.ts +83 -0
- package/src/internal/cursor-agent-template.ts +46 -0
- package/src/internal/deploy-client.ts +25 -6
- package/src/internal/deploy-manifest.ts +161 -0
- package/src/internal/deployment-scm-event-stream.ts +593 -0
- package/src/internal/discovery.ts +132 -3
- package/src/internal/init-project.ts +18 -153
- package/src/internal/init-scaffold.ts +176 -0
- package/src/internal/inline-stdio-mcp.ts +13 -0
- package/src/internal/json-schema.ts +24 -3
- package/src/internal/mcp-endpoint.ts +6 -0
- package/src/internal/mcp-host.ts +70 -9
- package/src/internal/mcp-oauth.ts +55 -1
- package/src/internal/package-inline-stdio.ts +5 -1
- package/src/internal/review-comments.ts +245 -0
- package/src/internal/sanitize-mcp-tool-name.ts +33 -0
- package/src/internal/sdk-runner.ts +50 -11
- package/src/internal/server.ts +19 -0
- package/src/internal/session-engine.ts +392 -19
- package/src/internal/shallow-clone.ts +595 -0
- package/src/internal/slack-provision-client.ts +3 -0
- package/src/internal/terminal-style.ts +67 -1
- package/src/internal/turn-lease-store.ts +147 -0
- package/src/internal/workspace.ts +33 -0
- package/src/storage-protocol.ts +247 -0
- package/src/storage.ts +16 -110
- package/src/tools.ts +7 -0
- package/src/types.ts +149 -7
- package/templates/agentic-owners/agent/agent.ts +3 -0
- package/templates/demo/agent/agent.ts +3 -0
- package/templates/pr-autofixer/agent/lib/drive-schemas.ts +4 -1
- package/templates/security-reviewer/agent/agent.ts +3 -0
- package/templates/triage/agent/agent.ts +3 -0
- package/dist/docs/assets/chunks/@localSearchIndexroot.5ozYNf74.js +0 -1
- package/dist/docs/assets/reference_connections.md.CSQiNzre.lean.js +0 -1
- package/dist/docs/assets/troubleshooting.md.CuVztCKs.js +0 -1
- package/dist/playground/assets/index-B4rcOgeP.css +0 -1
- package/dist/playground/assets/index-DXcY42Jv.js +0 -85
- /package/dist/docs/assets/{concepts.md.CqOsxbMU.lean.js → concepts.md.BXAm6G-C.lean.js} +0 -0
- /package/dist/docs/assets/{guides_mcp-oauth.md.C7G7IykG.lean.js → guides_mcp-oauth.md.CzEB6RaG.lean.js} +0 -0
- /package/dist/docs/assets/{reference_sessions.md.DBVFi2Sx.lean.js → reference_sessions.md.B0DdlM-K.lean.js} +0 -0
- /package/dist/docs/assets/{troubleshooting.md.CuVztCKs.lean.js → troubleshooting.md.DQ-hYuZT.lean.js} +0 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shallow SCM PR checkout for SDK agents that review a PR's code.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors Bugbot's `shallow_fetch` prefetch strategy
|
|
5
|
+
* (`backend/crates/napi_bugbot/src/temp_clone.rs`): instead of cloning the
|
|
6
|
+
* whole repository, run a single `git fetch --depth=1 --no-tags origin <head>
|
|
7
|
+
* <merge_base>` into a fresh checkout so the agents get the PR head working
|
|
8
|
+
* tree (plus the merge-base commit for `git diff baseSha headSha`) with one
|
|
9
|
+
* bounded network round-trip. Bugbot keeps a bare `--filter=tree:0` partial
|
|
10
|
+
* clone because its tools stream objects on demand; SDK agents read a real
|
|
11
|
+
* working tree, so we materialize the head checkout instead.
|
|
12
|
+
*
|
|
13
|
+
* SCM support follows Bugbot's provider seam (`IGitProvider.getCloneTarget`
|
|
14
|
+
* / the Rust `clone_url` dispatch): everything provider-specific — remote
|
|
15
|
+
* URL shape, git credential username convention, PR head ref layout — lives
|
|
16
|
+
* in one {@link ScmCloneTarget} produced by {@link resolveScmCloneTarget}.
|
|
17
|
+
* Supporting another SCM (GitLab, Bitbucket, …) means adding a resolver
|
|
18
|
+
* case and a default credential source; the fetch/verify/checkout machinery
|
|
19
|
+
* is provider-agnostic.
|
|
20
|
+
*
|
|
21
|
+
* Auth also mirrors Bugbot (`IGitProvider.getAccessToken` → token handed
|
|
22
|
+
* straight to git): the clone takes one explicit repo-scoped bearer token.
|
|
23
|
+
* For GitHub the default source is the serve host's Cursor-account lease —
|
|
24
|
+
* the same backend `GithubAccessService` mint Bugbot uses — which
|
|
25
|
+
* `CursorGithubCredentialProvider` installs as `GH_TOKEN` for child
|
|
26
|
+
* processes. Where Bugbot embeds the token in the clone URL, this module
|
|
27
|
+
* serves it through an inline credential helper that reads a child-process
|
|
28
|
+
* env var, so the token never lands in argv or in `.git/config` inside a
|
|
29
|
+
* working tree that untrusted PR code later executes in.
|
|
30
|
+
*
|
|
31
|
+
* INTERNAL: first-party host plumbing shared by agents in `factory/*` (e.g.
|
|
32
|
+
* the security reviewer's `prepare_review` stage). Consumed via relative
|
|
33
|
+
* source imports, following `tenant-mcp/run-mcp-registry.ts`.
|
|
34
|
+
*/
|
|
35
|
+
/** SCMs with shallow-clone support. */
|
|
36
|
+
export type ScmProvider = "github";
|
|
37
|
+
/**
|
|
38
|
+
* Everything git needs to clone one SCM's PR head. Provider-specific
|
|
39
|
+
* conventions live here and nowhere else.
|
|
40
|
+
*/
|
|
41
|
+
export type ScmCloneTarget = {
|
|
42
|
+
provider: ScmProvider;
|
|
43
|
+
/** `owner/name` — used for logs and error messages. */
|
|
44
|
+
repo: string;
|
|
45
|
+
prNumber: number;
|
|
46
|
+
/** HTTPS remote to fetch from. */
|
|
47
|
+
remoteUrl: string;
|
|
48
|
+
/** Username paired with the bearer token for git-over-HTTPS basic auth. */
|
|
49
|
+
credentialUsername: string;
|
|
50
|
+
/**
|
|
51
|
+
* Server-advertised PR head ref (e.g. GitHub `refs/pull/<n>/head`,
|
|
52
|
+
* GitLab `refs/merge-requests/<n>/head`) — the fallback when the pinned
|
|
53
|
+
* SHA cannot be fetched directly.
|
|
54
|
+
*/
|
|
55
|
+
prHeadRef: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Resolve a PR URL to its clone target, or `undefined` when the SCM has no
|
|
59
|
+
* shallow-clone support (callers then review on their fallback checkout —
|
|
60
|
+
* e.g. Origin PRs, where the host checkout already is the reviewed repo).
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveScmCloneTarget(prUrl: string): ScmCloneTarget | undefined;
|
|
63
|
+
/** Repo-scoped bearer for git-over-HTTPS. */
|
|
64
|
+
export type ShallowCloneAuth = {
|
|
65
|
+
token: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Default GitHub clone credential: the serve host's Cursor-account lease.
|
|
69
|
+
* `CursorGithubCredentialProvider` mints it repo-scoped from the backend and
|
|
70
|
+
* keeps `GH_TOKEN` refreshed for child processes; `GITHUB_TOKEN` covers
|
|
71
|
+
* local/CI runs that export the conventional variable instead.
|
|
72
|
+
*/
|
|
73
|
+
export declare function serveHostGithubAuth(env?: NodeJS.ProcessEnv): ShallowCloneAuth | undefined;
|
|
74
|
+
export type CommitRangeDiff = {
|
|
75
|
+
status: "ok";
|
|
76
|
+
diff: string;
|
|
77
|
+
} | {
|
|
78
|
+
status: "unavailable";
|
|
79
|
+
reason: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Diff two commits inside an existing shallow PR checkout, fetching either
|
|
83
|
+
* end on demand when the shallow history does not already contain it.
|
|
84
|
+
*
|
|
85
|
+
* Lives here because it needs the same authenticated git the clone uses —
|
|
86
|
+
* a `--depth=1` checkout usually lacks the older commit, so reading a range
|
|
87
|
+
* means another credentialed fetch. Never throws: every failure becomes an
|
|
88
|
+
* `unavailable` reason the caller can act on or surface.
|
|
89
|
+
*/
|
|
90
|
+
export declare function tryDiffCommitRange(args: {
|
|
91
|
+
/** Existing checkout to run git in (see {@link createShallowPrCheckout}). */
|
|
92
|
+
checkoutDir: string;
|
|
93
|
+
/** The checkout's clone target; supplies the remote's ref + auth conventions. */
|
|
94
|
+
target: ScmCloneTarget;
|
|
95
|
+
from: string;
|
|
96
|
+
to: string;
|
|
97
|
+
/** Restrict the diff to one path when set. */
|
|
98
|
+
file?: string | undefined;
|
|
99
|
+
/** Fetch credential; defaults to the target provider's credential source. */
|
|
100
|
+
auth?: ShallowCloneAuth | undefined;
|
|
101
|
+
}): Promise<CommitRangeDiff>;
|
|
102
|
+
export type ShallowPrCheckout = {
|
|
103
|
+
/** Directory containing the PR head working tree (detached at headSha). */
|
|
104
|
+
checkoutDir: string;
|
|
105
|
+
headSha: string;
|
|
106
|
+
/** True when the merge-base commit was also fetched (enables local diffs). */
|
|
107
|
+
baseFetched: boolean;
|
|
108
|
+
/** How the head commit was obtained. */
|
|
109
|
+
headSource: "sha_fetch" | "pr_ref_fetch";
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Create a fresh shallow checkout of a PR head at `checkoutDir`.
|
|
113
|
+
*
|
|
114
|
+
* Fetch order (both single depth-1 round-trips):
|
|
115
|
+
* 1. Fetch `headSha` (and `baseSha` when known) directly — GitHub advertises
|
|
116
|
+
* `allow-reachable-sha1-in-want`, and this pins the exact reviewed commit
|
|
117
|
+
* the way Bugbot's `shallow_fetch` does.
|
|
118
|
+
* 2. Fall back to the target's PR head ref, verifying it still resolves to
|
|
119
|
+
* `headSha` so the working tree cannot silently drift from the pinned
|
|
120
|
+
* patch in the review bundle.
|
|
121
|
+
*
|
|
122
|
+
* A missing merge-base commit is non-fatal (agents still have the pinned
|
|
123
|
+
* patch text in their prompt); a missing head checkout throws.
|
|
124
|
+
*/
|
|
125
|
+
export declare function createShallowPrCheckout(args: {
|
|
126
|
+
target: ScmCloneTarget;
|
|
127
|
+
headSha: string;
|
|
128
|
+
/** Merge-base SHA; fetched too so `git diff baseSha headSha` works locally. */
|
|
129
|
+
baseSha?: string | undefined;
|
|
130
|
+
checkoutDir: string;
|
|
131
|
+
/** Clone credential; required for HTTPS remotes, unused for file fixtures. */
|
|
132
|
+
auth?: ShallowCloneAuth | undefined;
|
|
133
|
+
}): Promise<ShallowPrCheckout>;
|
|
134
|
+
export type TryShallowPrCheckoutOptions = {
|
|
135
|
+
/** PR URL; resolved to a clone target (unsupported SCMs skip). */
|
|
136
|
+
prUrl: string;
|
|
137
|
+
/** Pinned head SHA; skipped (undefined result) when unknown. */
|
|
138
|
+
headSha?: string | undefined;
|
|
139
|
+
/** Merge-base SHA; fetched too so `git diff baseSha headSha` works locally. */
|
|
140
|
+
baseSha?: string | undefined;
|
|
141
|
+
checkoutDir: string;
|
|
142
|
+
/** Clone credential; defaults to the target provider's credential source. */
|
|
143
|
+
auth?: ShallowCloneAuth | undefined;
|
|
144
|
+
/** Test seam: clone this target instead of resolving `prUrl`. */
|
|
145
|
+
target?: ScmCloneTarget | undefined;
|
|
146
|
+
};
|
|
147
|
+
export type TryShallowPrCheckoutResult = {
|
|
148
|
+
/** Set when the shallow checkout succeeded. */
|
|
149
|
+
checkout?: ShallowPrCheckout;
|
|
150
|
+
/**
|
|
151
|
+
* Why there is no checkout: a skip gate or the clone failure's first error
|
|
152
|
+
* line. Callers surface this in their own results/logs so the reason is
|
|
153
|
+
* visible on hosts that do not capture this module's stderr.
|
|
154
|
+
*/
|
|
155
|
+
fallbackReason?: string;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Best-effort shallow PR checkout for hosts whose SDK agents should read the
|
|
159
|
+
* reviewed repo instead of the host's own checkout.
|
|
160
|
+
*
|
|
161
|
+
* Returns no checkout — leaving the caller on its fallback working
|
|
162
|
+
* directory — when the PR's SCM has no clone support (e.g. Origin PRs,
|
|
163
|
+
* where the host checkout is the reviewed repo), when no head SHA is
|
|
164
|
+
* pinned, when no clone credential is available, or when the clone fails;
|
|
165
|
+
* `fallbackReason` says which. Failures are logged, never thrown: agents
|
|
166
|
+
* still have the pinned patch in their prompts, so a missing checkout
|
|
167
|
+
* degrades quality rather than the run.
|
|
168
|
+
*/
|
|
169
|
+
export declare function tryCreateShallowPrCheckout(options: TryShallowPrCheckoutOptions): Promise<TryShallowPrCheckoutResult>;
|
|
170
|
+
//# sourceMappingURL=shallow-clone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shallow-clone.d.ts","sourceRoot":"","sources":["../../src/internal/shallow-clone.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,uCAAuC;AACvC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,WAAW,CAAC;IACtB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GACZ,cAAc,GAAG,SAAS,CA0B5B;AAED,6CAA6C;AAC7C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,gBAAgB,GAAG,SAAS,CAG9B;AAyBD,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,6EAA6E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C;CACrC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,0BAA0B,CAAC,CA+CrC"}
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { execFile } from "node:child_process";
|
|
11
|
+
import { mkdirSync, rmSync } from "node:fs";
|
|
12
|
+
import { promisify } from "node:util";
|
|
13
|
+
const execFileAsync = promisify(execFile);
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a PR URL to its clone target, or `undefined` when the SCM has no
|
|
16
|
+
* shallow-clone support (callers then review on their fallback checkout —
|
|
17
|
+
* e.g. Origin PRs, where the host checkout already is the reviewed repo).
|
|
18
|
+
*/
|
|
19
|
+
export function resolveScmCloneTarget(prUrl) {
|
|
20
|
+
let url;
|
|
21
|
+
try {
|
|
22
|
+
url = new URL(prUrl);
|
|
23
|
+
}
|
|
24
|
+
catch (_a) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const parts = url.pathname.split("/").filter(Boolean);
|
|
28
|
+
if (url.hostname === "github.com" &&
|
|
29
|
+
parts.length >= 4 &&
|
|
30
|
+
parts[2] === "pull" &&
|
|
31
|
+
Number.isInteger(Number(parts[3]))) {
|
|
32
|
+
const repo = `${parts[0]}/${parts[1]}`;
|
|
33
|
+
const prNumber = Number(parts[3]);
|
|
34
|
+
return {
|
|
35
|
+
provider: "github",
|
|
36
|
+
repo,
|
|
37
|
+
prNumber,
|
|
38
|
+
remoteUrl: `https://github.com/${repo}.git`,
|
|
39
|
+
credentialUsername: "x-access-token",
|
|
40
|
+
prHeadRef: `refs/pull/${prNumber}/head`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Default GitHub clone credential: the serve host's Cursor-account lease.
|
|
47
|
+
* `CursorGithubCredentialProvider` mints it repo-scoped from the backend and
|
|
48
|
+
* keeps `GH_TOKEN` refreshed for child processes; `GITHUB_TOKEN` covers
|
|
49
|
+
* local/CI runs that export the conventional variable instead.
|
|
50
|
+
*/
|
|
51
|
+
export function serveHostGithubAuth(env = process.env) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
const token = ((_b = (_a = env.GH_TOKEN) !== null && _a !== void 0 ? _a : env.GITHUB_TOKEN) !== null && _b !== void 0 ? _b : "").trim();
|
|
54
|
+
return token === "" ? undefined : { token };
|
|
55
|
+
}
|
|
56
|
+
/** Pair the provider's git-over-HTTPS username with the bearer token. */
|
|
57
|
+
function cloneCredential(target, auth) {
|
|
58
|
+
return auth === undefined
|
|
59
|
+
? undefined
|
|
60
|
+
: { username: target.credentialUsername, token: auth.token };
|
|
61
|
+
}
|
|
62
|
+
/** Default clone credential source per provider. */
|
|
63
|
+
function defaultCloneAuth(target) {
|
|
64
|
+
switch (target.provider) {
|
|
65
|
+
case "github":
|
|
66
|
+
return serveHostGithubAuth();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Cap on diff text handed to a model; beyond this it is truncated. */
|
|
70
|
+
const DIFF_MAX_CHARS = 80000;
|
|
71
|
+
/**
|
|
72
|
+
* Diff two commits inside an existing shallow PR checkout, fetching either
|
|
73
|
+
* end on demand when the shallow history does not already contain it.
|
|
74
|
+
*
|
|
75
|
+
* Lives here because it needs the same authenticated git the clone uses —
|
|
76
|
+
* a `--depth=1` checkout usually lacks the older commit, so reading a range
|
|
77
|
+
* means another credentialed fetch. Never throws: every failure becomes an
|
|
78
|
+
* `unavailable` reason the caller can act on or surface.
|
|
79
|
+
*/
|
|
80
|
+
export function tryDiffCommitRange(args) {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
var _a;
|
|
83
|
+
if (!isFullCommitSha(args.from) || !isFullCommitSha(args.to)) {
|
|
84
|
+
return {
|
|
85
|
+
status: "unavailable",
|
|
86
|
+
reason: "Could not compute a reliable diff because a commit SHA was not a full 40-character SHA.",
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const credential = cloneCredential(args.target, (_a = args.auth) !== null && _a !== void 0 ? _a : defaultCloneAuth(args.target));
|
|
90
|
+
for (const sha of [args.from, args.to]) {
|
|
91
|
+
if (!(yield ensureCommitFetched(args.checkoutDir, sha, args.target, credential))) {
|
|
92
|
+
return {
|
|
93
|
+
status: "unavailable",
|
|
94
|
+
reason: "Could not compute a reliable diff because a commit was unavailable in the checkout.",
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
const diff = yield git(args.checkoutDir, [
|
|
100
|
+
"diff",
|
|
101
|
+
"--no-ext-diff",
|
|
102
|
+
"--unified=80",
|
|
103
|
+
`${args.from}..${args.to}`,
|
|
104
|
+
...(args.file === undefined ? [] : ["--", args.file]),
|
|
105
|
+
]);
|
|
106
|
+
return {
|
|
107
|
+
status: "ok",
|
|
108
|
+
diff: diff.length <= DIFF_MAX_CHARS
|
|
109
|
+
? diff
|
|
110
|
+
: `${diff.slice(0, DIFF_MAX_CHARS)}\n\n[diff truncated at ${DIFF_MAX_CHARS} characters]`,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
catch (_b) {
|
|
114
|
+
return {
|
|
115
|
+
status: "unavailable",
|
|
116
|
+
reason: "Could not compute a reliable diff because git diff failed.",
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function isFullCommitSha(value) {
|
|
122
|
+
return /^[0-9a-f]{40}$/i.test(value);
|
|
123
|
+
}
|
|
124
|
+
/** Present already, or fetchable by SHA, or reachable from the PR head ref. */
|
|
125
|
+
function ensureCommitFetched(checkoutDir, sha, target, credential) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
if ((yield revParse(checkoutDir, sha)) !== undefined) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
const attempts = [
|
|
131
|
+
[...FETCH_ARGS, sha],
|
|
132
|
+
// Deeper history on the PR head ref: the older end of an inter-run range
|
|
133
|
+
// is usually an ancestor of the tip rather than the tip itself.
|
|
134
|
+
[
|
|
135
|
+
"fetch",
|
|
136
|
+
"--depth=200",
|
|
137
|
+
"--no-tags",
|
|
138
|
+
"--quiet",
|
|
139
|
+
"origin",
|
|
140
|
+
target.prHeadRef,
|
|
141
|
+
],
|
|
142
|
+
];
|
|
143
|
+
for (const attempt of attempts) {
|
|
144
|
+
try {
|
|
145
|
+
yield git(checkoutDir, attempt, credential);
|
|
146
|
+
if ((yield revParse(checkoutDir, sha)) !== undefined) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (_a) {
|
|
151
|
+
// Try the next strategy; the caller fails closed if none work.
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function logShallowClone(message, fields = {}) {
|
|
158
|
+
const suffix = Object.entries(fields)
|
|
159
|
+
.filter(([, value]) => value !== undefined)
|
|
160
|
+
.map(([key, value]) => `${key}=${String(value)}`)
|
|
161
|
+
.join(" ");
|
|
162
|
+
process.stderr.write(`[shallow-clone] ${message}${suffix ? ` ${suffix}` : ""}\n`);
|
|
163
|
+
}
|
|
164
|
+
function errorSummary(error) {
|
|
165
|
+
var _a;
|
|
166
|
+
return error instanceof Error
|
|
167
|
+
? ((_a = error.message.split("\n")[0]) !== null && _a !== void 0 ? _a : String(error))
|
|
168
|
+
: String(error);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Single-line git failure: the invoked git args (without the credential
|
|
172
|
+
* config noise) plus the first meaningful stderr line — the actual git
|
|
173
|
+
* diagnostic (auth, ref, network) — so fallback reasons surfaced to tool
|
|
174
|
+
* results say why, not just what ran.
|
|
175
|
+
*/
|
|
176
|
+
function gitError(args, error) {
|
|
177
|
+
var _a;
|
|
178
|
+
const stderr = error.stderr;
|
|
179
|
+
const detail = typeof stderr === "string"
|
|
180
|
+
? stderr
|
|
181
|
+
.split("\n")
|
|
182
|
+
.map((line) => line.trim())
|
|
183
|
+
.find((line) => line.length > 0)
|
|
184
|
+
: error instanceof Error
|
|
185
|
+
? ((_a = error.message.split("\n")[0]) !== null && _a !== void 0 ? _a : String(error))
|
|
186
|
+
: String(error);
|
|
187
|
+
return new Error(`git ${args.join(" ")} failed — ${detail}`);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The one credential helper git may use: serve the caller-provided
|
|
191
|
+
* credential from the child process env at request time. The shell reads
|
|
192
|
+
* the values when git asks, keeping the token out of argv.
|
|
193
|
+
*/
|
|
194
|
+
const CREDENTIAL_HELPER = '!f() { test "$1" = get && printf "username=$SHALLOW_CLONE_GIT_USERNAME\\npassword=$SHALLOW_CLONE_GIT_TOKEN\\n"; }; f';
|
|
195
|
+
function git(cwd, args, credential) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
// Async on purpose: fetches/checkouts of large repos take minutes, and the
|
|
198
|
+
// serve host runs the clone in-process. A synchronous git call blocks the
|
|
199
|
+
// event loop for the whole clone, freezing /v1/health and session streams
|
|
200
|
+
// long enough for the platform's probe budget to replace the engine.
|
|
201
|
+
try {
|
|
202
|
+
const { stdout } = yield execFileAsync("git", [
|
|
203
|
+
...(credential === undefined
|
|
204
|
+
? []
|
|
205
|
+
: ["-c", `credential.helper=${CREDENTIAL_HELPER}`]),
|
|
206
|
+
...args,
|
|
207
|
+
], {
|
|
208
|
+
cwd,
|
|
209
|
+
encoding: "utf8",
|
|
210
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
211
|
+
env: Object.assign(Object.assign(Object.assign({}, process.env), {
|
|
212
|
+
// Hermetic git: ignore global/system config so host-provisioned
|
|
213
|
+
// credential rewrites (`url.https://x-access-token:<token>@github
|
|
214
|
+
// .com/.insteadOf` entries scoped to a *different* repo, as cloud
|
|
215
|
+
// VMs bake in) cannot hijack auth away from the explicit token,
|
|
216
|
+
// and no ambient credential helpers run against PR-author input.
|
|
217
|
+
GIT_CONFIG_GLOBAL: "/dev/null", GIT_CONFIG_SYSTEM: "/dev/null", GIT_TERMINAL_PROMPT: "0" }), (credential === undefined
|
|
218
|
+
? {}
|
|
219
|
+
: {
|
|
220
|
+
SHALLOW_CLONE_GIT_USERNAME: credential.username,
|
|
221
|
+
SHALLOW_CLONE_GIT_TOKEN: credential.token,
|
|
222
|
+
})),
|
|
223
|
+
});
|
|
224
|
+
return stdout;
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
throw gitError(args, error);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
function revParse(cwd, rev) {
|
|
232
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
+
try {
|
|
234
|
+
const sha = (yield git(cwd, ["rev-parse", "--verify", `${rev}^{commit}`])).trim();
|
|
235
|
+
return sha === "" ? undefined : sha;
|
|
236
|
+
}
|
|
237
|
+
catch (_a) {
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
const FETCH_ARGS = ["fetch", "--depth=1", "--no-tags", "--quiet", "origin"];
|
|
243
|
+
/** Local tracking ref the PR head ref is fetched into. */
|
|
244
|
+
const LOCAL_PR_HEAD_REF = "refs/remotes/origin/shallow-clone-pr-head";
|
|
245
|
+
/**
|
|
246
|
+
* Create a fresh shallow checkout of a PR head at `checkoutDir`.
|
|
247
|
+
*
|
|
248
|
+
* Fetch order (both single depth-1 round-trips):
|
|
249
|
+
* 1. Fetch `headSha` (and `baseSha` when known) directly — GitHub advertises
|
|
250
|
+
* `allow-reachable-sha1-in-want`, and this pins the exact reviewed commit
|
|
251
|
+
* the way Bugbot's `shallow_fetch` does.
|
|
252
|
+
* 2. Fall back to the target's PR head ref, verifying it still resolves to
|
|
253
|
+
* `headSha` so the working tree cannot silently drift from the pinned
|
|
254
|
+
* patch in the review bundle.
|
|
255
|
+
*
|
|
256
|
+
* A missing merge-base commit is non-fatal (agents still have the pinned
|
|
257
|
+
* patch text in their prompt); a missing head checkout throws.
|
|
258
|
+
*/
|
|
259
|
+
export function createShallowPrCheckout(args) {
|
|
260
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
261
|
+
const { target, headSha, baseSha, checkoutDir, auth } = args;
|
|
262
|
+
const { repo, prNumber } = target;
|
|
263
|
+
const credential = cloneCredential(target, auth);
|
|
264
|
+
const startedAt = Date.now();
|
|
265
|
+
logShallowClone("cloning PR head", { repo, prNumber, headSha, baseSha });
|
|
266
|
+
rmSync(checkoutDir, { recursive: true, force: true });
|
|
267
|
+
mkdirSync(checkoutDir, { recursive: true });
|
|
268
|
+
yield git(checkoutDir, ["init", "--quiet"]);
|
|
269
|
+
yield git(checkoutDir, ["remote", "add", "origin", target.remoteUrl]);
|
|
270
|
+
const shaFetch = () => __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
const extraBase = baseSha === undefined || baseSha === headSha ? [] : [baseSha];
|
|
272
|
+
try {
|
|
273
|
+
yield git(checkoutDir, [...FETCH_ARGS, headSha, ...extraBase], credential);
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
if (extraBase.length === 0) {
|
|
277
|
+
throw error;
|
|
278
|
+
}
|
|
279
|
+
// The merge-base SHA may have aged out of reachability; the head commit
|
|
280
|
+
// is the part the review cannot proceed without, so retry it alone.
|
|
281
|
+
logShallowClone("combined sha fetch failed; retrying head sha alone", {
|
|
282
|
+
repo,
|
|
283
|
+
headSha,
|
|
284
|
+
baseSha,
|
|
285
|
+
error: errorSummary(error),
|
|
286
|
+
});
|
|
287
|
+
yield git(checkoutDir, [...FETCH_ARGS, headSha], credential);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
let headSource;
|
|
291
|
+
try {
|
|
292
|
+
yield shaFetch();
|
|
293
|
+
headSource = "sha_fetch";
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
const shaFetchError = errorSummary(error);
|
|
297
|
+
logShallowClone("sha fetch failed; falling back to PR head ref", {
|
|
298
|
+
repo,
|
|
299
|
+
prNumber,
|
|
300
|
+
headSha,
|
|
301
|
+
error: shaFetchError,
|
|
302
|
+
});
|
|
303
|
+
yield git(checkoutDir, [...FETCH_ARGS, `+${target.prHeadRef}:${LOCAL_PR_HEAD_REF}`], credential);
|
|
304
|
+
const fetchedSha = yield revParse(checkoutDir, LOCAL_PR_HEAD_REF);
|
|
305
|
+
if (fetchedSha !== headSha) {
|
|
306
|
+
throw new Error(`Shallow PR ref fetch for ${repo}#${prNumber} resolved to ${fetchedSha !== null && fetchedSha !== void 0 ? fetchedSha : "nothing"}, expected pinned head ${headSha} (sha fetch error: ${shaFetchError})`);
|
|
307
|
+
}
|
|
308
|
+
headSource = "pr_ref_fetch";
|
|
309
|
+
}
|
|
310
|
+
if ((yield revParse(checkoutDir, headSha)) === undefined) {
|
|
311
|
+
throw new Error(`Shallow fetch completed but head commit ${headSha} is missing from ${checkoutDir}`);
|
|
312
|
+
}
|
|
313
|
+
logShallowClone("fetch complete; materializing working tree", {
|
|
314
|
+
repo,
|
|
315
|
+
headSha,
|
|
316
|
+
fetchMs: Date.now() - startedAt,
|
|
317
|
+
});
|
|
318
|
+
yield git(checkoutDir, ["checkout", "--quiet", "--detach", headSha]);
|
|
319
|
+
let baseFetched = baseSha !== undefined &&
|
|
320
|
+
(yield revParse(checkoutDir, baseSha)) !== undefined;
|
|
321
|
+
if (baseSha !== undefined && baseSha !== headSha && !baseFetched) {
|
|
322
|
+
// Best-effort: local diffs are nice-to-have, the pinned patch in the
|
|
323
|
+
// prompt is the authoritative delta either way.
|
|
324
|
+
try {
|
|
325
|
+
yield git(checkoutDir, [...FETCH_ARGS, baseSha], credential);
|
|
326
|
+
baseFetched = (yield revParse(checkoutDir, baseSha)) !== undefined;
|
|
327
|
+
}
|
|
328
|
+
catch (error) {
|
|
329
|
+
logShallowClone("merge-base fetch failed; continuing without it", {
|
|
330
|
+
repo,
|
|
331
|
+
baseSha,
|
|
332
|
+
error: errorSummary(error),
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
logShallowClone("checkout ready", {
|
|
337
|
+
repo,
|
|
338
|
+
prNumber,
|
|
339
|
+
headSha,
|
|
340
|
+
baseSha,
|
|
341
|
+
headSource,
|
|
342
|
+
baseFetched,
|
|
343
|
+
durationMs: Date.now() - startedAt,
|
|
344
|
+
checkoutDir,
|
|
345
|
+
});
|
|
346
|
+
return { checkoutDir, headSha, baseFetched, headSource };
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Best-effort shallow PR checkout for hosts whose SDK agents should read the
|
|
351
|
+
* reviewed repo instead of the host's own checkout.
|
|
352
|
+
*
|
|
353
|
+
* Returns no checkout — leaving the caller on its fallback working
|
|
354
|
+
* directory — when the PR's SCM has no clone support (e.g. Origin PRs,
|
|
355
|
+
* where the host checkout is the reviewed repo), when no head SHA is
|
|
356
|
+
* pinned, when no clone credential is available, or when the clone fails;
|
|
357
|
+
* `fallbackReason` says which. Failures are logged, never thrown: agents
|
|
358
|
+
* still have the pinned patch in their prompts, so a missing checkout
|
|
359
|
+
* degrades quality rather than the run.
|
|
360
|
+
*/
|
|
361
|
+
export function tryCreateShallowPrCheckout(options) {
|
|
362
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
363
|
+
var _a, _b;
|
|
364
|
+
const { prUrl, headSha, baseSha, checkoutDir } = options;
|
|
365
|
+
const target = (_a = options.target) !== null && _a !== void 0 ? _a : resolveScmCloneTarget(prUrl);
|
|
366
|
+
if (target === undefined) {
|
|
367
|
+
logShallowClone("skipped: unsupported SCM for shallow clone", { prUrl });
|
|
368
|
+
return { fallbackReason: "skipped: unsupported SCM for shallow clone" };
|
|
369
|
+
}
|
|
370
|
+
if (headSha === undefined) {
|
|
371
|
+
logShallowClone("skipped: no pinned head SHA", {
|
|
372
|
+
repo: target.repo,
|
|
373
|
+
prUrl,
|
|
374
|
+
});
|
|
375
|
+
return { fallbackReason: "skipped: no pinned head SHA" };
|
|
376
|
+
}
|
|
377
|
+
const auth = (_b = options.auth) !== null && _b !== void 0 ? _b : defaultCloneAuth(target);
|
|
378
|
+
if (auth === undefined && target.remoteUrl.startsWith("https://")) {
|
|
379
|
+
// Fail fast instead of letting an unauthenticated fetch 404/hang: HTTPS
|
|
380
|
+
// clones need the provider's credential (or an explicit token).
|
|
381
|
+
logShallowClone("skipped: no clone credential", {
|
|
382
|
+
repo: target.repo,
|
|
383
|
+
provider: target.provider,
|
|
384
|
+
prUrl,
|
|
385
|
+
});
|
|
386
|
+
return {
|
|
387
|
+
fallbackReason: `skipped: no ${target.provider} clone credential (serve host token lease not installed)`,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
try {
|
|
391
|
+
return {
|
|
392
|
+
checkout: yield createShallowPrCheckout({
|
|
393
|
+
target,
|
|
394
|
+
headSha,
|
|
395
|
+
baseSha,
|
|
396
|
+
checkoutDir,
|
|
397
|
+
auth,
|
|
398
|
+
}),
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
catch (error) {
|
|
402
|
+
const reason = errorSummary(error);
|
|
403
|
+
logShallowClone("failed; caller falls back to host checkout", {
|
|
404
|
+
repo: target.repo,
|
|
405
|
+
prNumber: target.prNumber,
|
|
406
|
+
headSha,
|
|
407
|
+
error: reason,
|
|
408
|
+
});
|
|
409
|
+
return { fallbackReason: `clone failed: ${reason}` };
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
@@ -92,6 +92,8 @@ export interface SlackWizardPollResult {
|
|
|
92
92
|
status: string;
|
|
93
93
|
appId?: string;
|
|
94
94
|
oauthAuthorizeUrl?: string;
|
|
95
|
+
/** "pending" means the admin-approval request is already in Slack's queue. */
|
|
96
|
+
approvalRequest?: string;
|
|
95
97
|
error?: string;
|
|
96
98
|
localEnv?: {
|
|
97
99
|
botToken: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack-provision-client.d.ts","sourceRoot":"","sources":["../../src/internal/slack-provision-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,CAAC;AAEzC,gEAAgE;AAChE,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,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EAAE,WAAW,CAAC;QACjB,2CAA2C;QAC3C,QAAQ,EAAE,MAAM,CAAC;QACjB,sEAAsE;QACtE,IAAI,CAAC,EAAE;YAAE,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QACvB,sEAAsE;QACtE,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAgBnC;IAED,kDAAkD;IAC5C,SAAS,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAO3E;IAED,8EAA8E;IACxE,UAAU,CAAC,IAAI,EAAE;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,iBAAiB,CAAC;KACzB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhB;YAEa,OAAO;CA0CtB"}
|
|
@@ -17,6 +17,24 @@ export declare function makePalette(enabled: boolean): TerminalPalette;
|
|
|
17
17
|
export declare function stdoutPalette(): TerminalPalette;
|
|
18
18
|
/** Palette for human-facing stderr (login progress, warnings). */
|
|
19
19
|
export declare function stderrPalette(): TerminalPalette;
|
|
20
|
+
/** Visible column count, ignoring CSI color/style and OSC 8 hyperlinks. */
|
|
21
|
+
export declare function visibleWidth(text: string): number;
|
|
22
|
+
/** True when `text` already carries CSI styling or OSC 8 (do not wrap again). */
|
|
23
|
+
export declare function hasAnsiStyling(text: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Clickable terminal hyperlink (OSC 8). The URI is the click target; `label`
|
|
26
|
+
* is what the user sees. `visibleWidth` ignores the OSC wrapper.
|
|
27
|
+
*/
|
|
28
|
+
export declare function terminalHyperlink(url: string, label: string, enabled?: boolean): string;
|
|
29
|
+
/**
|
|
30
|
+
* Unicode box around `lines`. `color` wraps the whole box (borders + body)
|
|
31
|
+
* so a warning panel can be yellow without per-line prefixes.
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatTerminalBox(lines: readonly string[], options?: {
|
|
34
|
+
color?: (s: string) => string;
|
|
35
|
+
minWidth?: number;
|
|
36
|
+
padding?: number;
|
|
37
|
+
}): string;
|
|
20
38
|
/** Wipe the terminal before a `dev` Enter-to-restart cycle. */
|
|
21
39
|
export declare function clearTerminal(stream?: NodeJS.WriteStream): void;
|
|
22
40
|
//# sourceMappingURL=terminal-style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-style.d.ts","sourceRoot":"","sources":["../../src/internal/terminal-style.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7B,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/B,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/B;
|
|
1
|
+
{"version":3,"file":"terminal-style.d.ts","sourceRoot":"","sources":["../../src/internal/terminal-style.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC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