From cd6f8b5c81b30b3100fb8aec8e8e829e4b9c25d2 Mon Sep 17 00:00:00 2001 From: moilanik Date: Tue, 3 Mar 2026 11:49:35 +0200 Subject: [PATCH] refactor: symlinks point directly to ai-superpower/.ai/ (revert copy approach) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove DEV_ROOT/.ai/ copy step — AI_TARGET = SCRIPT_DIR/.ai (repo) - remove /dev/tty deleted copy folder from filesystem - edits to .ai/ from any project land directly in git working tree - docs/apply-requirements.md: FR-3 rewritten - README.md: principles, install steps, directory structure updated --- README.md | 28 ++++++++++++++-------------- apply.sh | 10 +--------- docs/apply-requirements.md | 9 ++++----- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 2998283..1f7d713 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ Good instructions are what make that possible — they allow AI to produce outpu ## Principles - **Generic vs. project-specific** — `.ai/` instructions know nothing about individual projects. Project knowledge lives in each project's own `docs/ai-context.md`. -- **Single install, real folder** — `apply.sh` copies `.ai/` into your dev root. Every project symlinks there. One source of truth, zero drift. +- **Symlink, never copy** — every project's `.ai/` symlinks directly to the `ai-superpower` repo. Edits land in git immediately — no sync step, no drift. - **Modular loading** — AI loads only the relevant instruction files per task, not everything at once. -- **One change, all projects** — re-run `apply.sh`, done. `.ai/` is refreshed and all symlinks already point to it. +- **One change, all projects** — edit any instruction file from any project, commit to `ai-superpower`, and all projects pick it up on next `git pull` or `curl | bash`. - **Version controlled** — instructions are managed in git. Changes are tracked, history is preserved, and rolling back is straightforward. ## Install @@ -27,25 +27,26 @@ This script **must be run via `curl | bash`** from your dev root. Running it dir What it does: 1. Clones (or updates) this repo into `dev_root/ai-superpower/` -2. Copies `.ai/` into your dev root as a real folder -3. Scans for all projects (up to 4 levels deep) and creates a `.ai` symlink in each -4. Adds `.ai` to each project's `.gitignore` -5. Creates `docs/ai-context.md` and `docs/architecture.md` templates in projects that have a `docs/` folder but no such files yet -6. Writes a `.ai-superpower.version` file to your dev root with the run timestamp and commit hash +2. Scans for all projects (up to 4 levels deep) and creates a `.ai` symlink in each pointing to `ai-superpower/.ai/` +3. Adds `.ai` to each project's `.gitignore` +4. Creates `docs/ai-context.md` and `docs/architecture.md` templates in projects that have a `docs/` folder but no such files yet — asks first if the folder doesn't exist +5. Writes a `.ai-superpower.version` file to your dev root with the run timestamp and commit hash ``` dev_root/ ← run curl from here -├── .ai/ ← installed here as a real folder (refreshed on every run) ├── ai-superpower/ ← cloned here automatically +│ └── .ai/ ← instruction source (git tracked) ├── project-a/ -│ └── .ai → dev_root/.ai/ ← symlink +│ └── .ai → dev_root/ai-superpower/.ai/ ← symlink ├── project-b/ -│ └── .ai → dev_root/.ai/ ← symlink +│ └── .ai → dev_root/ai-superpower/.ai/ ← symlink └── some-folder/ └── project-c/ ← nested projects found automatically (maxdepth 4) - └── .ai → dev_root/.ai/ + └── .ai → dev_root/ai-superpower/.ai/ ``` +Any edits made to `.ai/` instruction files from within any project land directly in the `ai-superpower/` git working tree — visible with `git diff` and committable without a sync step. + See [docs/apply-requirements.md](docs/apply-requirements.md) for the full requirements and [docs/apply-usecases.md](docs/apply-usecases.md) for a detailed flow diagram. ## AI setup @@ -62,7 +63,7 @@ Verify that every AI response begins with this confirmation. If it does not, the ``` ai-superpower/ -└── .ai/ ← source, copied to dev_root/.ai/ on every run +└── .ai/ ← source + symlink target (git tracked) ├── ai-root-instructions.md ← entry point, read first └── instructions/ ├── behavior/ ← how AI approaches its work @@ -70,9 +71,8 @@ ai-superpower/ └── constraints/ ← what AI must not do dev_root/ -├── .ai/ ← real folder (copy of above) └── project-x/ - ├── .ai → dev_root/.ai/ ← symlink + ├── .ai → dev_root/ai-superpower/.ai/ ← symlink └── docs/ ├── ai-context.md ← project-specific context, never overwritten once customised └── architecture.md ← project architecture, never overwritten once customised diff --git a/apply.sh b/apply.sh index 4e0fc78..6d7ff4d 100755 --- a/apply.sh +++ b/apply.sh @@ -34,7 +34,7 @@ fi # ── Local mode ──────────────────────────────────────────────────────────────── SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" DEV_ROOT="${2:?DEV_ROOT not passed — re-run via curl}" -AI_TARGET="$DEV_ROOT/.ai" +AI_TARGET="$SCRIPT_DIR/.ai" TEMPLATE_MARKER="