centralize guides and rails under mosaic with runtime compatibility links

This commit is contained in:
Jason Woltje
2026-02-17 11:39:52 -06:00
parent a1c2efef1c
commit 4eac2c76e6
85 changed files with 10785 additions and 0 deletions

View File

@@ -73,6 +73,11 @@ bash scripts/agent/critical.sh
bash scripts/agent/session-end.sh
```
## Shared Rails
- Quality and orchestration guides: `~/.mosaic/guides/`
- Shared automation rails: `~/.mosaic/rails/`
## Repo-Specific Notes
- Add project constraints and workflows here.

65
bin/mosaic-link-runtime-assets Executable file
View File

@@ -0,0 +1,65 @@
#!/usr/bin/env bash
set -euo pipefail
MOSAIC_HOME="${MOSAIC_HOME:-$HOME/.mosaic}"
backup_stamp="$(date +%Y%m%d%H%M%S)"
link_file() {
local src="$1"
local dst="$2"
mkdir -p "$(dirname "$dst")"
if [[ -L "$dst" ]]; then
local cur
cur="$(readlink -f "$dst" 2>/dev/null || true)"
local want
want="$(readlink -f "$src" 2>/dev/null || true)"
if [[ -n "$cur" && -n "$want" && "$cur" == "$want" ]]; then
return
fi
rm -f "$dst"
elif [[ -e "$dst" ]]; then
mv "$dst" "${dst}.mosaic-bak-${backup_stamp}"
fi
ln -s "$src" "$dst"
}
link_tree_files() {
local src_root="$1"
local dst_root="$2"
[[ -d "$src_root" ]] || return
while IFS= read -r -d '' src; do
local rel
rel="${src#$src_root/}"
local dst="$dst_root/$rel"
link_file "$src" "$dst"
done < <(find "$src_root" -type f -print0)
}
# Claude compatibility layer: keep existing ~/.claude workflows functional,
# but source canonical rails from ~/.mosaic.
link_tree_files "$MOSAIC_HOME/guides" "$HOME/.claude/agent-guides"
link_tree_files "$MOSAIC_HOME/rails/git" "$HOME/.claude/scripts/git"
link_tree_files "$MOSAIC_HOME/rails/codex" "$HOME/.claude/scripts/codex"
link_tree_files "$MOSAIC_HOME/rails/bootstrap" "$HOME/.claude/scripts/bootstrap"
link_tree_files "$MOSAIC_HOME/templates/agent" "$HOME/.claude/templates"
for qa_script in \
debug-hook.sh \
qa-hook-handler.sh \
qa-hook-stdin.sh \
qa-hook-wrapper.sh \
qa-queue-monitor.sh \
remediation-hook-handler.sh; do
src="$MOSAIC_HOME/rails/qa/$qa_script"
[[ -f "$src" ]] || continue
link_file "$src" "$HOME/.claude/scripts/$qa_script"
done
echo "[mosaic-link] Runtime compatibility assets linked"
echo "[mosaic-link] Canonical source: $MOSAIC_HOME"