Skip to content

Commit 2126e41

Browse files
committed
smoke-init: update hook version assertions to v3 (fix CI for v0.12.0); add bridge demo script
1 parent 12881a7 commit 2126e41

2 files changed

Lines changed: 178 additions & 7 deletions

File tree

docs/bridge-demo-script.md

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Kai ↔ Git Bridge — Demo Script
2+
3+
**Length:** ~2:30
4+
**Goal:** show a mixed team working in one repo, half on kai, half on plain git, neither changing their workflow.
5+
6+
## Setup (before recording)
7+
8+
Two terminals side-by-side (or tmux split).
9+
- **Left** — labeled `alice (kai)`. Prompt: `alice $`
10+
- **Right** — labeled `bob (git-only)`. Prompt: `bob $`
11+
12+
Both start in empty directories. A bare repo exists at `/tmp/team-repo.git` that both will push to.
13+
14+
```bash
15+
# Run this once, offscreen:
16+
rm -rf /tmp/team-repo.git /tmp/alice /tmp/bob
17+
git init --bare /tmp/team-repo.git
18+
mkdir /tmp/alice /tmp/bob
19+
cd /tmp/alice && git clone /tmp/team-repo.git . && git config user.email alice@demo && git config user.name Alice
20+
cd /tmp/bob && git clone /tmp/team-repo.git . && git config user.email bob@demo && git config user.name Bob
21+
echo 'def hello(): return "hi"' > /tmp/alice/app.py
22+
cd /tmp/alice && git add -A && git commit -m "initial" -q && git push -q origin main
23+
cd /tmp/bob && git pull -q
24+
```
25+
26+
---
27+
28+
## Scene 1 — The pitch (0:00–0:15)
29+
30+
**Camera on full screen with title card:**
31+
32+
> **Two teammates. One repo. Different tools.**
33+
> Alice wants kai. Bob's happy with git.
34+
> Neither has to change.
35+
36+
---
37+
38+
## Scene 2 — Alice turns on the bridge (0:15–0:45)
39+
40+
**Left terminal only.**
41+
42+
*Say:* "Alice wants kai, so she enables the bridge. That's one command."
43+
44+
```bash
45+
alice $ kai init --git-bridge
46+
```
47+
48+
*Wait for output. When `✓ Kai initialized` appears, say:*
49+
50+
"Done. Three git hooks, a kai snapshot graph, and a sentinel that says 'this repo is bridged'."
51+
52+
```bash
53+
alice $ kai bridge status
54+
# kai↔git bridge: enabled
55+
56+
alice $ ls .git/hooks | grep -v sample
57+
# post-commit
58+
# pre-commit
59+
# pre-push
60+
```
61+
62+
---
63+
64+
## Scene 3 — Alice works in kai. Bob sees a clean git commit. (0:45–1:30)
65+
66+
**Left terminal.**
67+
68+
*Say:* "Alice builds a feature. Her AI agent calls `kai_checkpoint_now` when it's done. Watch what happens on Bob's side."
69+
70+
```bash
71+
alice $ cat > app.py <<'EOF'
72+
def hello(): return "hi"
73+
74+
def goodbye(name):
75+
return f"bye, {name}"
76+
EOF
77+
78+
alice $ kai bridge milestone --label "add goodbye" --assert tests-pass
79+
# (silent — milestone becomes a git commit)
80+
81+
alice $ git log --oneline -3
82+
# abc1234 add goodbye
83+
# def5678 initial
84+
85+
alice $ git push
86+
```
87+
88+
**Switch to right terminal.** *Say:* "Bob pulls. What does he see?"
89+
90+
```bash
91+
bob $ git pull
92+
bob $ git log -1 --format=fuller
93+
```
94+
95+
*Pause on the commit message. The trailers are visible:*
96+
97+
```
98+
add goodbye
99+
100+
Kai-Snapshot: 296cc854cf6fff77428677e2f0f6ce457e7c5d3e57bfeceb8f70bde621257bb2
101+
Kai-Assert: tests-pass
102+
```
103+
104+
*Say:* "A meaningful commit. A readable log. Trailers he can ignore — or use to ask kai what changed."
105+
106+
---
107+
108+
## Scene 4 — Bob works in plain git. Alice sees it in kai. (1:30–2:10)
109+
110+
**Right terminal.**
111+
112+
*Say:* "Bob doesn't know kai exists. He just writes code."
113+
114+
```bash
115+
bob $ cat >> app.py <<'EOF'
116+
117+
def thanks(name):
118+
return f"thanks, {name}"
119+
EOF
120+
121+
bob $ git add app.py && git commit -m "add thanks"
122+
bob $ git push
123+
```
124+
125+
**Switch to left terminal.** *Say:* "Alice pulls."
126+
127+
```bash
128+
alice $ git pull
129+
```
130+
131+
*Say:* "Her post-commit hook sees Bob's commit, imports it into kai. Watch."
132+
133+
```bash
134+
alice $ kai ref list | grep git.
135+
# git.HEAD Snapshot 9d8e...
136+
# git.a1b2c3d4 Snapshot 8f7e... ← Alice's milestone
137+
# git.f5e6d7c8 Snapshot 9d8e... ← Bob's commit, auto-imported
138+
139+
alice $ kai activity
140+
# (shows Bob's change as a kai snapshot)
141+
```
142+
143+
*Say:* "Alice's agent can now review, reason about, and build on Bob's work — even though Bob never touched kai."
144+
145+
---
146+
147+
## Scene 5 — The punch line (2:10–2:30)
148+
149+
**Full screen, text overlay:**
150+
151+
> **Alice ran one command.**
152+
> **Bob didn't run any.**
153+
> **The team is together in one repo.**
154+
155+
*Say:* "That's the bridge. Adoption stops being a team decision."
156+
157+
---
158+
159+
## Notes for recording
160+
161+
- **Pace:** don't rush the trailer reveal — it's the "aha" moment. Let the viewer read `Kai-Assert: tests-pass` themselves.
162+
- **What to cut if short on time:** Scene 4's `kai activity` call. The git-ref list alone tells the story.
163+
- **What to add if extending:** show `kai review open` on Alice's side pulling in Bob's change as a reviewable unit with proper trust context. That's the future-sell.
164+
- **Fallback if milestone subcommand output is noisy:** redirect to `/dev/null` and cut to `git log` directly.
165+
- **Color/contrast:** if you have a dark theme, the commit trailers (`Kai-*`) should be legible at YouTube 1080p — test a freeze-frame before publishing.
166+
167+
## Talking points to weave in (optional)
168+
169+
- "This is the problem every new-substrate tool has: how do you onboard when your teammate doesn't want to?"
170+
- "Git is canonical. Kai is additive. The bridge makes that explicit instead of a marketing claim."
171+
- "Re-entrancy-safe: the milestone commit carries a trailer that tells the import hook 'skip me'. No loops."

scripts/smoke-init.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
# - personal org auto-creation
1010
# - repo creation and remote wiring
1111
# - first push to kai-server
12-
# - post-commit / pre-push git hooks installed at v2 (never block git)
12+
# - post-commit / pre-push git hooks installed at v3 (never block git)
1313
# - broken .kai directory does NOT block git commit
14-
# - selfHealHooks() upgrades a v1 hook to v2 on any kai invocation
14+
# - selfHealHooks() upgrades a v1 hook to v3 on any kai invocation
1515
#
1616
# Environment variables (all required):
1717
# KAI_SERVER - base URL, e.g. https://staging.kaicontext.com
@@ -62,8 +62,8 @@ echo "=== 4. Post-init assertions ==="
6262
fail() { echo " ASSERT FAIL: $1"; exit 1; }
6363

6464
[ -d .kai ] || fail ".kai directory not created"
65-
grep -q "kai-managed-hook v2" .git/hooks/pre-commit || fail "pre-commit hook is not v2"
66-
grep -q "kai-managed-hook v2" .git/hooks/pre-push || fail "pre-push hook is not v2"
65+
grep -q "kai-managed-hook v3" .git/hooks/pre-commit || fail "pre-commit hook is not v3"
66+
grep -q "kai-managed-hook v3" .git/hooks/pre-push || fail "pre-push hook is not v3"
6767
grep -q "Already logged in\|Logged in as" /tmp/init.log || fail "init did not reach login step"
6868
kai doctor > /tmp/doctor.log 2>&1 || true
6969
grep -q "logged in" /tmp/doctor.log || fail "kai doctor does not see an active login"
@@ -88,15 +88,15 @@ cat > .git/hooks/pre-commit <<'OLDHOOK'
8888
kai capture
8989
OLDHOOK
9090
chmod +x .git/hooks/pre-commit
91-
grep -q "kai-managed-hook v2" .git/hooks/pre-commit && fail "test setup wrong: hook is still v2"
91+
grep -q "kai-managed-hook v3" .git/hooks/pre-commit && fail "test setup wrong: hook is still v3"
9292

9393
# Invoke a real subcommand so cobra runs PersistentPreRun (and thus
9494
# selfHealHooks). `kai --version` and `kai --help` short-circuit in
9595
# cobra and do NOT run PreRun hooks — don't use them for this test.
9696
kai doctor >/dev/null 2>&1 || true
9797

98-
grep -q "kai-managed-hook v2" .git/hooks/pre-commit || fail "selfHealHooks did not upgrade v1 -> v2"
99-
echo " hook upgraded to v2 after kai invocation"
98+
grep -q "kai-managed-hook v3" .git/hooks/pre-commit || fail "selfHealHooks did not upgrade v1 -> v3"
99+
echo " hook upgraded to v3 after kai invocation"
100100
echo
101101

102102
echo "=== SMOKE PASSED ==="

0 commit comments

Comments
 (0)