Skip to content

Commit 490bb81

Browse files
committed
Document vendored .repos subtrees and agent guidance.
AGENTS.md directs agents to use .repos as source of truth for Effect and TanStack; the plan records subtree add/pull workflow.
1 parent fff4168 commit 490bb81

2 files changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Vendored repositories via squashed `git subtree`
2+
3+
Use this when you want upstream code (for example a separate **docs** site repo, or a library monorepo) inside this project **without** carrying the full upstream history—only periodic squashed imports.
4+
5+
## Local source of truth (`.repos`)
6+
7+
Trees under `.repos/<name>` are the **authoritative local copy** for how we reason about those upstream projects in _this_ repo. When you implement against, debug, or document behavior of a vendored library or service (for example Effect from `effect-smol`, or Dokploy’s server/API surface), **prefer reading and citing the code and bundled docs inside `.repos`** over guessing from npm types, third-party summaries, or stale web pages. Treat each prefix as the canonical reference for that dependency until you refresh it with `git subtree pull`.
8+
9+
Currently tracked:
10+
11+
| Prefix | Upstream | Branch |
12+
| ------------------------- | --------------------------------------------------------------------------- | -------- |
13+
| `.repos/effect` | [Effect-TS/effect-smol](https://github.com/Effect-TS/effect-smol) | `main` |
14+
| `.repos/tanstack-router` | [TanStack/router](https://github.com/TanStack/router) | `main` |
15+
16+
## Prerequisites
17+
18+
- This directory must be a **git repository** with at least one commit on the current branch (use `git commit --allow-empty -m "Initial commit"` if the tree is otherwise empty).
19+
- Pick a **prefix** path where the subtree will live. Existing convention: `.repos/<short-name>` (example: `.repos/effect` for [effect-smol](https://github.com/Effect-TS/effect-smol)). For a documentation-only repo, `.repos/docs` is a reasonable choice.
20+
21+
## Add a repository (squashed, no upstream history)
22+
23+
Replace the URL, branch, and prefix as needed.
24+
25+
```bash
26+
git subtree add --prefix=.repos/docs https://github.com/OWNER/REPO-NAME main --squash
27+
```
28+
29+
- `--prefix` — directory that will contain the cloned tree; Git creates it.
30+
- Last argument before `--squash` — upstream branch (often `main` or `master`).
31+
- `--squash` — produces a single “squashed” commit for the imported tree instead of replaying every upstream commit.
32+
33+
Resulting history will look like: one commit that merges the squashed import into your branch.
34+
35+
## Update from upstream (squashed)
36+
37+
When you want to pull newer commits from the same repo and branch:
38+
39+
```bash
40+
git subtree pull --prefix=.repos/docs https://github.com/OWNER/REPO-NAME main --squash
41+
```
42+
43+
Resolve any merge conflicts if they appear, then commit as usual.
44+
45+
## Optional: shortcut with a named remote
46+
47+
```bash
48+
git remote add docs-upstream https://github.com/OWNER/REPO-NAME
49+
git subtree pull --prefix=.repos/docs docs-upstream main --squash
50+
```
51+
52+
## Notes
53+
54+
- Subtree imports are **normal files** in your repo; there is no nested `.git` inside the prefix.
55+
- Document the chosen **URL**, **branch**, and **prefix** in your team’s onboarding or runbook so future updates use the same values.
56+
- Keep the **Local source of truth** table above in sync whenever you add or rename a subtree under `.repos`.
57+
- For pushing changes _back_ to the upstream repo, `git subtree split` is possible but uncommon for read-only vendoring; treat the subtree as imported unless you intentionally maintain a fork workflow.

AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Agent guidance
2+
3+
## Vendored upstream (`.repos`)
4+
5+
Trees under `.repos/` are **squashed git subtrees** of upstream repositories. They are the **source of truth** in this repo for how we implement, debug, and document behavior of the matching installed dependencies.
6+
7+
When working on code that uses these libraries:
8+
9+
1. **Read and cite** the vendored tree first — package source, tests, examples, migration notes, and bundled docs inside `.repos` — instead of guessing from npm types alone, third-party summaries, or stale web pages.
10+
2. **Follow patterns** shown in upstream examples and tests in the vendored tree unless this project documents an intentional deviation.
11+
3. **Refresh** vendored copies with `git subtree pull` when you need newer upstream behavior (see [.plans/vendored-repo-git-subtree.md](.plans/vendored-repo-git-subtree.md)).
12+
13+
| Prefix | Upstream | Use for npm packages |
14+
| --- | --- | --- |
15+
| `.repos/effect` | [Effect-TS/effect-smol](https://github.com/Effect-TS/effect-smol) (`main`) | `effect` and related Effect v4 packages from that monorepo |
16+
| `.repos/tanstack-router` | [TanStack/router](https://github.com/TanStack/router) (`main`) | `@tanstack/react-router`, `@tanstack/react-start`, and their workspace siblings in that monorepo |
17+
18+
Subtree imports are normal tracked files; there is no nested `.git` under these prefixes. Do not treat vendored trees as editable forks unless the task explicitly requires upstream contributions.

0 commit comments

Comments
 (0)