Skip to content

Commit 00a0cdb

Browse files
committed
feat(source-control): add Cursor Origin provider
1 parent 9c0baf4 commit 00a0cdb

18 files changed

Lines changed: 2332 additions & 8 deletions

File tree

‎apps/server/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"@t3tools/source-control-azure-devops": "workspace:*",
5757
"@t3tools/source-control-bitbucket": "workspace:*",
5858
"@t3tools/source-control-core": "workspace:*",
59+
"@t3tools/source-control-cursor-origin": "workspace:*",
5960
"@t3tools/source-control-definitions": "workspace:*",
6061
"@t3tools/source-control-forgejo": "workspace:*",
6162
"@t3tools/source-control-gitcafe": "workspace:*",

‎apps/server/src/sourceControl/sourceControlDefinitions.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as AzureDevOpsDriver from "@t3tools/source-control-azure-devops/server/driver";
22
import * as BitbucketDriver from "@t3tools/source-control-bitbucket/server/driver";
3+
import * as CursorOriginDriver from "@t3tools/source-control-cursor-origin/server/driver";
34
import { builtInSourceControlDefinitions } from "@t3tools/source-control-definitions/registry";
45
import * as ForgejoDriver from "@t3tools/source-control-forgejo/server/driver";
56
import * as GitCafeDriver from "@t3tools/source-control-gitcafe/server/driver";
@@ -9,6 +10,7 @@ import * as GitLabDriver from "@t3tools/source-control-gitlab/server/driver";
910
/** In the shared registry's order, which is the order hosts are listed and probed in. */
1011
export const BUILT_IN_SOURCE_CONTROL_DRIVER_LIST = [
1112
GitHubDriver.driver,
13+
CursorOriginDriver.driver,
1214
GitLabDriver.driver,
1315
GitCafeDriver.driver,
1416
ForgejoDriver.driver,

‎docs/user/source-control.md‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Source control
22

3-
T3 Code integrates with GitHub, GitLab, Forgejo, Gitea, Bitbucket, Azure DevOps, and GitCafe to clone
4-
and publish repositories, create pull requests, and review changes.
3+
T3 Code integrates with GitHub, GitLab, Forgejo, Gitea, Bitbucket, Azure DevOps, GitCafe, and Cursor
4+
Origin to clone and publish repositories, create pull requests, and review changes.
55

66
## Review turn changes
77

@@ -129,6 +129,20 @@ sent to `git.cafe`; `CAFE_TOKEN` follows `CAFE_HOST` if you set it. Repositories
129129
Line comments are not available for GitCafe pull requests yet.
130130
Merging a stack lands it through GitCafe, and updating a branch restacks the layers above it.
131131

132+
### Cursor Origin
133+
134+
Install the [Origin CLI](https://cursor.com/docs/origin/cli) and sign in. Signing in also sets up Git
135+
credentials for `origin.cursor.com`:
136+
137+
```bash
138+
curl -fsSL https://downloads.cursor.com/origin/install.sh | sh
139+
origin auth login
140+
```
141+
142+
If cloning or pushing asks for a username, run `origin auth setup-git` to point Git at the CLI's
143+
credentials again. Origin repositories use HTTPS and are published privately. Repositories mirrored
144+
from GitHub keep their pull requests on GitHub; open those from the GitHub remote.
145+
132146
## Start, clone, or publish a project
133147

134148
To start from nothing, choose **New project** in the command palette (`Cmd/Ctrl+K`), or
@@ -261,9 +275,9 @@ running count. A tick belongs to the pull request rather than to a commit, so sc
261275
single commit keeps them. A file pushed to after you cleared it comes back marked **Changed**.
262276

263277
On GitHub these are GitHub's own viewed marks, so a review carries between T3 Code and github.com
264-
in either direction. Forgejo, GitLab, Bitbucket, and Azure DevOps expose no record T3 Code can read, so the
265-
server you are connected to keeps them instead: they follow you across the apps connected to that
266-
server, but the host's own site will not show them, and the count reads **viewed in T3 Code**.
278+
in either direction. Forgejo, GitLab, Bitbucket, Azure DevOps, and Cursor Origin expose no record
279+
T3 Code can read, so the server you are connected to keeps them instead: they follow you across the
280+
apps connected to that server, but the host's own site will not show them, and the count reads **viewed in T3 Code**.
267281

268282
On mobile, open a changed file and mark it viewed from its header. Viewed files collapse,
269283
and their marks follow the same rules as on web and desktop.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"knip": "knip --preprocessor ./scripts/knip-schemas.ts",
3535
"knip:check": "vp run knip:check:all",
3636
"knip:check:files": "knip --include files,dependencies --no-config-hints",
37-
"knip:check:exports": "knip --workspace apps/server --workspace apps/desktop --workspace apps/web --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --workspace packages/provider-core --workspace packages/provider-acp --workspace packages/provider-acp-registry --workspace packages/provider-testing --workspace packages/provider-pi --workspace packages/provider-muse --workspace packages/provider-opencode --workspace packages/provider-cursor --workspace packages/provider-fx --workspace packages/provider-grok --workspace packages/provider-kiro --workspace packages/secret-provider-core --workspace packages/secret-provider-definitions --workspace packages/secret-provider-onepassword --workspace packages/source-control-core --workspace packages/source-control-definitions --workspace packages/source-control-azure-devops --workspace packages/source-control-bitbucket --workspace packages/source-control-forgejo --workspace packages/source-control-gitcafe --workspace packages/source-control-github --workspace packages/source-control-gitlab --workspace packages/source-control-testing --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints",
37+
"knip:check:exports": "knip --workspace apps/server --workspace apps/desktop --workspace apps/web --workspace packages/client-runtime --workspace packages/contracts --workspace packages/effect-acp --workspace packages/effect-codex-app-server --workspace packages/shared --workspace packages/ssh --workspace packages/tailscale --workspace packages/provider-core --workspace packages/provider-acp --workspace packages/provider-acp-registry --workspace packages/provider-testing --workspace packages/provider-pi --workspace packages/provider-muse --workspace packages/provider-opencode --workspace packages/provider-cursor --workspace packages/provider-fx --workspace packages/provider-grok --workspace packages/provider-kiro --workspace packages/secret-provider-core --workspace packages/secret-provider-definitions --workspace packages/secret-provider-onepassword --workspace packages/source-control-core --workspace packages/source-control-cursor-origin --workspace packages/source-control-definitions --workspace packages/source-control-azure-devops --workspace packages/source-control-bitbucket --workspace packages/source-control-forgejo --workspace packages/source-control-gitcafe --workspace packages/source-control-github --workspace packages/source-control-gitlab --workspace packages/source-control-testing --exports --preprocessor ./scripts/knip-schemas.ts --no-config-hints",
3838
"knip:production": "knip --production --preprocessor ./scripts/knip-schemas.ts",
3939
"lint:mobile": "node scripts/mobile-native-static-check.ts",
4040
"mobile:install": "node scripts/mobile-native-client.ts ensure",

‎packages/client-runtime/src/sourceControlClients.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,27 @@ describe("sourceControlClients.parseChangeRequestUrl", () => {
3838
});
3939
});
4040

41+
it("reads a Cursor Origin pull request under Origin's git host, not as GitHub's /pull/", () => {
42+
for (const url of [
43+
"https://cursor.com/codebase/Acme.Team/Web-App/pull/42",
44+
"http://www.cursor.com/codebase/Acme.Team/Web-App/pull/42/files?w=1#diff",
45+
]) {
46+
expect(parse(url), url).toEqual({
47+
host: "origin.cursor.com",
48+
repository: "acme.team/web-app",
49+
number: 42,
50+
});
51+
expect(kindOf(url), url).toBe("cursor-origin");
52+
}
53+
expect(
54+
sourceControlClients.parseChangeRequestUrl("https://cursor.com/codebase/acme/web/pull/42")
55+
?.link.repositoryUrl,
56+
).toBe("https://cursor.com/codebase/acme/web");
57+
expect(parse("https://cursor.com/codebase/acme/web")).toBeNull();
58+
expect(kindOf("https://www.cursor.com/updates/pull/42")).toBeUndefined();
59+
expect(kindOf("https://github.com/acme/web/pull/42")).toBe("github");
60+
});
61+
4162
it("reads Forgejo URLs even when the hostname contains github", () => {
4263
expect(parse("https://github.internal/team/repo/pulls/7")).toEqual({
4364
host: "github.internal",
@@ -254,6 +275,7 @@ describe("sourceControlClients.recognizeRemote", () => {
254275
expect(kindOfRemote("https://bitbucket.gitlab.example/o/r")).toBe("gitlab");
255276
expect(kindOfRemote("https://bitbucket.visualstudio.com/p/_git/r")).toBe("azure-devops");
256277
expect(kindOfRemote("[email protected]:pingdotgg/t3code.git")).toBe("gitcafe");
278+
expect(kindOfRemote("https://origin.cursor.com/acme/web.git")).toBe("cursor-origin");
257279
});
258280

259281
it("reads a remote no host claims as an unknown host, and a local path as no host", () => {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "@t3tools/source-control-cursor-origin",
3+
"private": true,
4+
"type": "module",
5+
"exports": {
6+
"./shared/definition": {
7+
"types": "./src/shared/definition.ts",
8+
"import": "./src/shared/definition.ts"
9+
},
10+
"./server/driver": {
11+
"types": "./src/server/driver.ts",
12+
"import": "./src/server/driver.ts"
13+
}
14+
},
15+
"scripts": {
16+
"typecheck": "effect-tsgo tsrs --noEmit"
17+
},
18+
"dependencies": {
19+
"@effect/platform-node": "catalog:",
20+
"@t3tools/contracts": "workspace:*",
21+
"@t3tools/shared": "workspace:*",
22+
"@t3tools/source-control-core": "workspace:*",
23+
"effect": "catalog:"
24+
},
25+
"devDependencies": {
26+
"@types/node": "catalog:"
27+
}
28+
}

0 commit comments

Comments
 (0)