From 3d83c3a65260ea529bb5c9dc7253c485fcddca79 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 5 Jul 2026 22:06:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20(scripts):=20Add=20bootstrap-ai?= =?UTF-8?q?-workspace.sh=20to=20install=20org=20AI=20scaffold?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Installs CLAUDE.md, AGENTS.md, .claude/rules/, and .claude/skills/ from this repo into a contributor's local multi-repo workspace root via symlinks (per .claude/WORKSPACE.md), so org context stays live without re-running the script after every baseline change. Supports --dry-run, never clobbers a local override at the target path, and reports a created/updated/skipped/failed summary per item. --- scripts/bootstrap-ai-workspace.sh | 205 ++++++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100755 scripts/bootstrap-ai-workspace.sh diff --git a/scripts/bootstrap-ai-workspace.sh b/scripts/bootstrap-ai-workspace.sh new file mode 100755 index 0000000..67fef55 --- /dev/null +++ b/scripts/bootstrap-ai-workspace.sh @@ -0,0 +1,205 @@ +#!/usr/bin/env bash +# +# bootstrap-ai-workspace.sh — install the ai-agent-assembly org AI baseline +# (CLAUDE.md, AGENTS.md, .claude/rules/, .claude/skills/) into a contributor's +# local multi-repo workspace root, per the layout defined in +# .claude/WORKSPACE.md (AAASM-3939) and tracked as AAASM-3943. +# +# Usage: +# ./scripts/bootstrap-ai-workspace.sh [--dry-run] +# +# This is a plain local script: no network calls, no eval, nothing piped from +# the network. It only reads from this repo checkout and writes into the +# workspace root you pass in. + +set -euo pipefail + +# --- Why symlinks instead of copies ----------------------------------------- +# Symlinks mean an edit to CLAUDE.md/AGENTS.md/.claude/rules/.claude/skills in +# this repo (after a `git pull`) is picked up immediately by every workspace +# that installed it, with no need to re-run this script. Copies would silently +# drift out of date the moment this repo's source-of-truth files change. +# ----------------------------------------------------------------------------- + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +usage() { + echo "Usage: $(basename "${BASH_SOURCE[0]}") [--dry-run]" >&2 +} + +DRY_RUN=0 +WORKSPACE_ROOT="" + +for arg in "$@"; do + case "${arg}" in + --dry-run) + DRY_RUN=1 + ;; + -h|--help) + usage + exit 0 + ;; + -*) + echo "Unknown flag: ${arg}" >&2 + usage + exit 1 + ;; + *) + if [[ -n "${WORKSPACE_ROOT}" ]]; then + echo "Unexpected extra argument: ${arg}" >&2 + usage + exit 1 + fi + WORKSPACE_ROOT="${arg}" + ;; + esac +done + +if [[ -z "${WORKSPACE_ROOT}" ]]; then + echo "Error: is required." >&2 + usage + exit 1 +fi + +# Counters for the final summary. +CREATED=0 +UPDATED=0 +SKIPPED=0 +FAILED=0 + +# One human-readable line per item, appended as we go, printed at the end. +declare -a REPORT_LINES=() + +record() { + # record + local status="$1" + local message="$2" + case "${status}" in + created) CREATED=$((CREATED + 1)) ;; + updated) UPDATED=$((UPDATED + 1)) ;; + skipped) SKIPPED=$((SKIPPED + 1)) ;; + failed) FAILED=$((FAILED + 1)) ;; + esac + REPORT_LINES+=("[${status}] ${message}") +} + +ensure_directory() { + # ensure_directory