aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-01 14:16:15 -0500
committerCraig Jennings <c@cjennings.net>2026-06-01 14:16:15 -0500
commit19e39aeefb138e623d80566d7ef9b60f01b58822 (patch)
tree2e98dde9b8cfd92054b36bcaa66de8b8f726f9ad /scripts
parent225c60df3ffe4d2163d8d42975d4cb74fe5ada39 (diff)
downloadrulesets-19e39aeefb138e623d80566d7ef9b60f01b58822.tar.gz
rulesets-19e39aeefb138e623d80566d7ef9b60f01b58822.zip
feat(install-ai): create top-level inbox/ on bootstrap
install-ai now creates a top-level inbox/ with a .gitkeep in every project it bootstraps. inbox-send treats a project as a messaging target only when it has both a .ai/ marker and a top-level inbox/, so before this a freshly bootstrapped project couldn't receive cross-project handoffs until the inbox was made by hand. The directory is created in both track and gitignore modes, since inbox/ is a project-root convention independent of whether .ai/ is tracked. The step is idempotent, so a project that already has an inbox keeps its contents.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install-ai.sh8
-rw-r--r--scripts/tests/install-ai.bats27
2 files changed, 35 insertions, 0 deletions
diff --git a/scripts/install-ai.sh b/scripts/install-ai.sh
index 8993f0d..a5b38a8 100755
--- a/scripts/install-ai.sh
+++ b/scripts/install-ai.sh
@@ -119,6 +119,13 @@ mkdir -p "$project/.ai/sessions"
mkdir -p "$project/.ai/references"
mkdir -p "$project/.ai/retrospectives"
+# Top-level inbox/ — the cross-project messaging target (inbox-send needs a
+# .ai/ marker AND a top-level inbox/). Created in both track and gitignore
+# modes since inbox/ is a project-root convention independent of .ai/
+# tracking. Idempotent: a pre-existing inbox/ and its contents are preserved.
+mkdir -p "$project/inbox"
+touch "$project/inbox/.gitkeep"
+
# Rsync canonical content (everything except notes.org, which gets templated).
rsync -a "$CANONICAL/protocols.org" "$project/.ai/protocols.org"
rsync -a "$CANONICAL/someday-maybe.org" "$project/.ai/someday-maybe.org"
@@ -159,6 +166,7 @@ echo
echo " project: $project"
echo " tracking: ${track_mode:-not-a-git-repo}"
echo " notes.org: project=$project_name, date=$today"
+echo " inbox/: created (inbox-send target)"
echo
echo "Next steps:"
echo " - Add a language bundle: make install-lang PROJECT=$project"
diff --git a/scripts/tests/install-ai.bats b/scripts/tests/install-ai.bats
index d67a9c6..dca70ea 100644
--- a/scripts/tests/install-ai.bats
+++ b/scripts/tests/install-ai.bats
@@ -37,6 +37,33 @@ teardown() {
[ -f "$TEST_HOME/code/fresh/.ai/protocols.org" ]
[ -f "$TEST_HOME/code/fresh/.ai/notes.org" ]
grep -qFx ".ai/" "$TEST_HOME/code/fresh/.gitignore"
+ # Top-level inbox/ is created so the project is an inbox-send target.
+ [ -d "$TEST_HOME/code/fresh/inbox" ]
+ [ -f "$TEST_HOME/code/fresh/inbox/.gitkeep" ]
+}
+
+@test "install-ai: creates top-level inbox/ in --track mode too" {
+ mkdir -p "$TEST_HOME/code/inbox-track"
+ (cd "$TEST_HOME/code/inbox-track" && git init -q)
+
+ run bash "$INSTALL_AI" --track "$TEST_HOME/code/inbox-track"
+
+ [ "$status" -eq 0 ]
+ [ -d "$TEST_HOME/code/inbox-track/inbox" ]
+ [ -f "$TEST_HOME/code/inbox-track/inbox/.gitkeep" ]
+}
+
+@test "install-ai: preserves a pre-existing inbox/ with content" {
+ mkdir -p "$TEST_HOME/code/has-inbox/inbox"
+ (cd "$TEST_HOME/code/has-inbox" && git init -q)
+ echo "handoff" > "$TEST_HOME/code/has-inbox/inbox/2026-06-01-existing.org"
+
+ run bash "$INSTALL_AI" --gitignore "$TEST_HOME/code/has-inbox"
+
+ [ "$status" -eq 0 ]
+ [ -d "$TEST_HOME/code/has-inbox/inbox" ]
+ # Existing inbox content is untouched.
+ [ -f "$TEST_HOME/code/has-inbox/inbox/2026-06-01-existing.org" ]
}
@test "install-ai --track: lands .gitkeep stubs in empty dirs" {