diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/install-ai.sh | 8 | ||||
| -rw-r--r-- | scripts/tests/install-ai.bats | 27 |
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" { |
