Separate collaborator docs from operator refresh

This commit is contained in:
virgil
2026-06-08 08:57:34 -07:00
parent f8b09eade7
commit e1020f0ec7
3 changed files with 30 additions and 143 deletions

View File

@@ -61,10 +61,11 @@ section0-docs pull
section0-docs status section0-docs status
MESSAGE="Describe the doc change" section0-docs commit MESSAGE="Describe the doc change" section0-docs commit
section0-docs push section0-docs push
git rev-parse --short HEAD
``` ```
After a push, ask Virgil to refresh the AFFiNE copies. For now that refresh is After a push, send Virgil the short commit hash. AFFiNE refresh is handled by
manual. The current refresh command lives in `docs/projection-operations.md`. the lab operator side; collaborators do not need the home-lab repo.
## Contributor Setup ## Contributor Setup
@@ -83,9 +84,33 @@ Then prove write access without changing `main`:
section0-docs push-test section0-docs push-test
``` ```
`push-test` pushes the current commit to a temporary scratch branch and deletes `push-test` does not commit files and does not change `main`. It pushes the
that branch immediately. If Git prompts for a password, use a Gitea access token current commit to a temporary scratch branch, then deletes that branch
rather than your normal account password. immediately. If Git prompts for a password, use a Gitea access token rather
than your normal account password.
## End-To-End Smoke Test
Use this when setting up a new machine:
```sh
section0-docs pull
cd "$(section0-docs open)"
printf '\nMBP sync smoke test: %s\n' "$(date -Is)" >> rta/reports/current-status.md
section0-docs status
MESSAGE="MBP sync smoke test" section0-docs commit
section0-docs push
git rev-parse --short HEAD
```
Send the printed commit hash to Virgil. After the AFFiNE copies are refreshed,
the smoke line should appear in:
```text
Agent Workspace / Section 0 / Git Projections / RTA Handbook / RTA Status
```
## Source Models ## Source Models

View File

@@ -1,99 +0,0 @@
# Projection Operations
This repo is projected into AFFiNE manually for now.
Canonical Gitea repo:
```text
http://100.64.0.1:30087/section0/rta-handbook.git
```
Projected AFFiNE path:
```text
Agent Workspace / Section 0 / Git Projections / RTA Handbook
```
## What A Collaborator Does
```sh
cd ~/Developer/Section0/rta-handbook
git pull --ff-only
# edit Markdown
git add .
git commit -m "Update docs"
git push
```
## What The Projection Operator Does
The operator keeps a separate checkout so projection never depends on a
collaborator's dirty working tree.
Nice wrapper:
```sh
/Users/virgil/Developer/rta/tmp/markdown-projection-gitea/collaborator-checkout/rta-handbook/scripts/project-section0-rta-handbook.sh
```
It pulls the projector checkout, checks it is clean, and runs the AFFiNE
projection command.
Manual equivalent:
```sh
git -C /Users/virgil/Developer/rta/tmp/markdown-projection-gitea/projector-checkout/rta-handbook pull --ff-only
```
Then from `home-lab-v7`:
```sh
cd /Users/virgil/Developer/Virgil-Info/home-lab-v7
nix develop --command bash -lc 'scripts/ops/sync-obsidian-affine.rb \
--name section0-rta-handbook \
--source /Users/virgil/Developer/rta/tmp/markdown-projection-gitea/projector-checkout/rta-handbook \
--username projection-bot \
--authentik-sub rta-projection-bot \
--affine-workspace "Agent Workspace" \
--affine-workspace-id 53ea0a0b-eca7-4887-8e31-f5b2a8ab7744 \
--affine-user-id ce42f50a-5367-4466-920b-7422c4e27de0 \
--affine-namespace 'Section 0/Git Projections/RTA Handbook' \
--include "**/*.md" \
--apply'
```
Expected healthy result currently includes five docs:
```text
docs: 5
mark stale: 0
mode: one-way read-only AFFiNE docs
```
## Push-To-Projection Automation
Pushing to `main` can trigger sync, but it should be implemented as a small
projection worker, not as a Gitea container hook.
Preferred shape:
```text
Gitea push webhook
-> RTA projection worker endpoint
-> pull projector checkout
-> validate clean source
-> run projection
-> emit logs/receipt
```
This keeps Gitea as Git infrastructure and keeps projection policy in RTA. A
server-side Git hook inside the Gitea container would be harder to observe,
harder to recover, and too tightly coupled to the packaged app internals.
## Rule Of Thumb
If the source repo changes, pull the projector checkout and run projection.
If AFFiNE changes, treat it as a comment or sketch. Move durable edits back to
Markdown before projecting again.

View File

@@ -1,39 +0,0 @@
#!/usr/bin/env sh
set -eu
PROJECTOR_DIR="${PROJECTOR_DIR:-/Users/virgil/Developer/rta/tmp/markdown-projection-gitea/projector-checkout/rta-handbook}"
HOME_LAB_DIR="${HOME_LAB_DIR:-/Users/virgil/Developer/Virgil-Info/home-lab-v7}"
if [ ! -d "$PROJECTOR_DIR/.git" ]; then
echo "Sync checkout not found: $PROJECTOR_DIR" >&2
exit 1
fi
if [ ! -d "$HOME_LAB_DIR" ]; then
echo "home-lab-v7 not found: $HOME_LAB_DIR" >&2
exit 1
fi
echo "==> Pulling the Git docs checkout"
git -C "$PROJECTOR_DIR" pull --ff-only
echo "==> Checking the Git docs checkout is clean"
if [ -n "$(git -C "$PROJECTOR_DIR" status --porcelain)" ]; then
git -C "$PROJECTOR_DIR" status --short
echo "Git docs checkout is dirty; refresh must read a clean source." >&2
exit 1
fi
echo "==> Refreshing AFFiNE from Markdown"
cd "$HOME_LAB_DIR"
nix develop --command bash -lc "scripts/ops/sync-obsidian-affine.rb \
--name section0-rta-handbook \
--source '$PROJECTOR_DIR' \
--username projection-bot \
--authentik-sub rta-projection-bot \
--affine-workspace 'Agent Workspace' \
--affine-workspace-id 53ea0a0b-eca7-4887-8e31-f5b2a8ab7744 \
--affine-user-id ce42f50a-5367-4466-920b-7422c4e27de0 \
--affine-namespace 'Section 0/Git Projections/RTA Handbook' \
--include '**/*.md' \
--apply"