Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

source-control.md

182 lines9.0 KB

1# Source control
2​
3T3 Code integrates with GitHub, GitLab, Forgejo, Gitea, Bitbucket, and Azure DevOps to clone and publish
4repositories, create pull requests, and review changes.
5​
6## Connect an account
7​
8Install Git and configure authentication on the machine running your T3 Code server. For a remote
9environment, do this on the remote machine. After signing in, open **Settings → Source Control**
10and choose **Rescan**.
11​
12### GitHub
13​
14Install [GitHub CLI](https://cli.github.com/) 2.81.0 or newer, then sign in:
15​
16```bash
17gh auth login
18```
19​
20### Forgejo and Gitea
21​
22Install [Forgejo CLI (`fj`)](https://codeberg.org/forgejo-contrib/forgejo-cli) or
23[Gitea CLI (`tea`)](https://gitea.com/gitea/tea) 0.16 or later on your T3 Code server.
24Sign in with `fj --host https://your-server auth add-token` or `tea login add`.
25Repeat for each server you use, including Codeberg.
26​
27T3 Code prefers a matching `fj` login and falls back to `tea` when `fj` is unavailable
28or has no login for that server. Once an account is selected, failed actions stay on that
29account. Settings shows the detected CLI. Forgejo and Gitea share one integration entry.
30Servers hosted under a URL subpath, such as `https://example.com/forgejo`, use `tea` because
31fj 0.6 does not preserve the subpath when checking its account.
32​
33When cloning or publishing, use a full repository URL to select a specific server.
34You can use `owner/repo` when only one fj server is configured, or with your default `tea`
35login when fj is unavailable or unconfigured. With multiple fj servers, use the full URL.
36If you have multiple `tea` accounts on one server, select one with
37`tea login default <login-name>`. Git push and clone also need Git credentials or an SSH key
38for that server.
39​
40### GitLab
41​
42Install [GitLab CLI](https://gitlab.com/gitlab-org/cli), then sign in:
43​
44```bash
45glab auth login
46```
47​
48### Bitbucket
49​
50Set an access token in the server's environment:
51​
52```bash
53export T3CODE_BITBUCKET_ACCESS_TOKEN="your-access-token"
54```
55​
56Or use an Atlassian account email and API token with read/write access to repositories and pull
57requests, plus user read access (`read:user:bitbucket`):
58​
59```bash
60export T3CODE_BITBUCKET_EMAIL="you@example.com"
61export T3CODE_BITBUCKET_API_TOKEN="your-token"
62```
63​
64The access token takes precedence if both are configured. Restart the server after changing these
65variables.
66​
67### Azure DevOps
68​
69Install [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/), add the DevOps extension, and sign in:
70​
71```bash
72az extension add --name azure-devops
73az login
74```
75​
76## Clone or publish a project
77​
78Use **Add Project** in the command palette (`Cmd/Ctrl+K`) to clone a repository. Choose a hosting
79provider or paste a Git URL, then choose where to save it. The project opens right away while the
80clone runs in the background: you can write your first prompt, and sending waits until the files
81are in place. A toast tracks progress and lets you cancel; if the clone fails, retry it from the
82toast or from the banner above the composer.
83​
84For a local Git repository without a remote, **Publish Repository** creates a hosted repository,
85adds it as `origin`, and pushes your commits. If there are no commits yet, it creates the remote;
86make your first commit before pushing.
87​
88## Create a pull request
89​
90Use a thread's Git actions to commit, push, and create a pull request. T3 Code can generate commit
91messages, review titles, and descriptions from your changes.
92​
93Choose the writing style and model in **Settings → Source Control**. **Repository conventions**
94uses the project's instructions and recent commit subjects.
95​
96## Review and merge
97​
98Open **Pull requests** to review changes and comments, request reviewers, check out a branch,
99or merge. You can edit review titles and descriptions and your own comments where the host allows it.
100GitLab calls these merge requests.
101​
102GitHub, GitLab, and Azure DevOps support auto-merge while checks are outstanding. GitHub also
103supports approving waiting fork workflows and opening a revert pull request for a merged change.
104​
105GitHub sharing is off by default. In Settings → Connections → GitHub sharing (Environments on mobile), choose
106**Read PRs** or **Read and act** for each environment you trust to share GitHub access.
107Enable both the original environment and the environment answering its requests on this client.
108**Read and act** can use broader GitHub permissions than the original environment's credential;
109only enable it for environments you control and trust. Changing a saved endpoint or removing an
110environment clears its permission.
111​
112GitHub review details, linked PR status, and permitted review actions can then use another
113connected environment signed in to the same GitHub account. Each needs a project on that host.
114A connected local environment is preferred for actions and can answer slow or failed reads.
115Browsers and mobile clients need a paired environment to use its GitHub CLI credentials.
116Credentials stay on their machines. Previously verified credentials remain usable for routing
117for ten minutes during a GitHub outage; new credentials must be verified first. An action with
118an uncertain result is never automatically retried elsewhere. Listings, diffs, and checkout or
119PR creation from Git actions continue to use the project's environment.
120​
121For Azure DevOps, use the host website to change comments. Bitbucket does not support reopening a
122declined pull request.
123​
124### Mark files as viewed
125​
126Tick a file off in the **Code** tab once you have read it and it collapses; the toolbar keeps a
127running count. A tick belongs to the pull request rather than to a commit, so scoping the tab to a
128single commit keeps them. A file pushed to after you cleared it comes back marked **Changed**.
129​
130On GitHub these are GitHub's own viewed marks, so a review carries between T3 Code and github.com
131in either direction. Forgejo, GitLab, Bitbucket, and Azure DevOps expose no record T3 Code can read, so the
132server you are connected to keeps them instead: they follow you across the apps connected to that
133server, but the host's own site will not show them, and the count reads **viewed in T3 Code**.
134​
135The **Code** tab is a web and desktop surface. The mobile app reports a pull request's status but
136does not show its diff, so marks are made and read on web and desktop.
137​
138## Troubleshooting
139​
140- **Not authenticated:** run the provider's login command on the server, then rescan. For Bitbucket,
141 confirm the running server received the environment variables.
142- **GitHub sign-in cannot be verified:** update GitHub CLI to at least 2.81.0.
143- **Push fails despite a connected account:** check the Git remote's credentials. SSH and HTTPS
144 remotes can require separate setup from the hosting provider's API access.
145- **A review cannot load:** open it on the host website while resolving connectivity, permissions,
146 or rate limits.
147​
148## Linked pull requests
149​
150A thread can hold several pull requests, including reviews from another repository on the same host.
151Use **Link pull request** in the command palette or **Linked pull requests** panel, or right-click a
152pull request link in the conversation. Creating a pull request from Git actions links it automatically.
153Agents can link their pull requests with the `link_pull_request` tool.
154​
155Use **Link this PR** in a branch-detected badge's tooltip to keep it with the thread. From a review
156on the Pull Requests page, **Link to thread** lets you search for an active thread. The review header
157also lists the threads that link to it, including archived threads, so you can return to their context.
158​
159Thread badges show a stack's layer count or the current review number with a count of additional
160links. On mobile, the Git overview lists linked reviews and their stacks; tap a review to open it.
161Linking and unlinking are available in the web and desktop clients.
162​
163The **Linked pull requests** panel lists every review and groups stacks. Unlink a review from its
164row menu. An unlinked stack layer stays out of later syncs. Open linked reviews refresh on the server;
165closed reviews refresh periodically so reopening one on the host is detected. Merged reviews refresh
166when requested. With **Auto-settle merged threads** enabled, a thread can settle after every linked
167review is terminal. An open or unsynced link keeps it active.
168​
169Cross-repository links use a project on the same host. Azure DevOps reviews require a project checked
170out from the matching organization and repository.
171​
172## GitHub stacks
173​
174The Pull Requests page shows each PR's position in its GitHub stack. Open the stack badge in a
175review to navigate its layers. **Merge stack** submits the selected pull request and every unmerged
176layer below it to GitHub together, respecting branch rules and merge queues. The confirmation shows
177the scope and merge strategy. GitHub rebases the remaining stack after merging.
178​
179**Rebase stack** updates remote branches from bottom to top without changing your local checkout.
180It can rewrite history and restart checks. If a layer fails, earlier updates remain; resolve that
181layer before retrying. GitHub may require manual conflict resolution after a lower layer is amended,
182even when its changes look independent. Stack actions require an environment that supports them.