# apply.sh — requirements ## Goal A single bash script that gives any developer AI superpowers across all their projects in one command. Run once to set up, run again to repair. No configuration, no questions. --- ## Functional requirements ### FR-1 Bootstrap via curl - **FR-1.1** When run via `curl | bash`, the script detects it has no filesystem location (`BASH_SOURCE[0]` is empty) - **FR-1.2** If `ai-superpower/` does not exist in `$PWD`: clone the repo there - **FR-1.3** If `ai-superpower/` already exists: run `git pull` to update it - **FR-1.4** After clone/pull: re-exec the local copy of `apply.sh` and exit the bootstrap process ### FR-2 Project discovery - **FR-2.1** Scan dev root recursively for directories containing `.git` - **FR-2.2** Dev root is the parent directory of the script's own location - **FR-2.3** Exclude any project containing a `.ai-superpower` marker file in its root — this identifies the ai-superpower repo itself regardless of what the directory is named - **FR-2.4** Maximum scan depth: 4 levels below dev root (`-maxdepth 4` from dev root) ### FR-3 Symlink - **FR-3.1** Copy `ai-superpower/.ai/` to `DEV_ROOT/.ai/` as a real folder on every run — this keeps the instructions up to date when the repo is pulled - **FR-3.2** Add `.ai` to `DEV_ROOT/.gitignore` (create file if needed) - **FR-3.3** For each discovered project: create `project/.ai` as a symlink pointing to `DEV_ROOT/.ai/` (absolute path) - **FR-3.4** If symlink is already correct: skip silently - **FR-3.5** If symlink is missing or broken: create it ### FR-4 .gitignore - **FR-4.1** Check if `.ai` is present in `project/.gitignore` - **FR-4.2** If missing: append `.ai` to the file (create file if it does not exist) - **FR-4.3** If already present: skip silently ### FR-5 ai-context.md - **FR-5.1** If `project/docs/` does not exist: print a warning and skip context setup for this project - **FR-5.2** If `project/docs/ai-context.md` does not exist: create it from a template - **FR-5.3** The template contains section headings and inline instructions explaining what each section should contain and how to fill it in (manually or by asking the AI) - **FR-5.4** If file already exists and the first line is the factory-reset marker (`