ai-superpower/docs/apply-usecases.md
moilanik 172bfa78e9 docs: fix outdated references to old implementation
Remove QUICK-REFERENCE.md from .ai/ — it contained kube-log project-specific
content (hardcoded paths, OpenShift/ArgoCD config) that was leaking into all
projects via the symlink.

Update docs to match the actual apply.sh implementation:
- apply.md: rewrite to reflect curl-only invocation, bootstrap/local phases,
  factory-reset marker behaviour; remove .ai-instructions.conf and interactive
  checklist references
- architecture.md: remove scripts/ subdirectory and .ai-instructions.conf that
  were never implemented
- apply-usecases.md: remove INSTALL subgraph (rm -rf + cp -r was never done),
  fix symlink targets to SCRIPT_DIR/.ai
- apply-requirements.md: NFR-1 corrected (TTY-gated prompt exists), NFR-4
  updated to <150 lines, .ai-instructions.conf removed from out-of-scope list
2026-03-03 12:55:24 +02:00

3.8 KiB
Raw Permalink Blame History

apply.sh — use cases

flowchart TD
    DEV([Developer in dev root]) -- "curl -fsSL ...apply.sh | bash" --> BS1
    DEV -- "bash apply.sh directly" --> GUARD["✗ must run via curl\nprint curl command\nexit 1"]

    subgraph BOOTSTRAP ["── Bootstrap  BASH_SOURCE empty ──"]
        BS1{"ai-superpower/\nexists in DEV_ROOT?"}
        BS1 -- "No" --> BS2["git clone REPO_URL ai-superpower/"]
        BS1 -- "Yes" --> BS3["git pull ai-superpower/"]
        BS2 -- "fail" --> BSE1["✗ print error, exit 1"]
        BS3 -- "fail" --> BSE2["✗ print error, exit 1"]
        BS2 -- "ok" --> BS4["exec bash apply.sh --bootstrapped DEV_ROOT\nstdin reopened from /dev/tty"]
        BS3 -- "ok" --> BS4
    end

    BS4 --> L1

    subgraph LOCAL ["── Local mode  --bootstrapped flag present ──"]
        L1["SCRIPT_DIR = dir of apply.sh\nDEV_ROOT = arg 2\nAI_TARGET = SCRIPT_DIR/.ai"]

        L1 --> SCAN1

        subgraph SCAN ["── Scan DEV_ROOT ──"]
            SCAN1["find DEV_ROOT\n-mindepth 2 -maxdepth 4\n-name .git -type d"]
            SCAN1 --> SCAN2{".ai-superpower\nin project root?"}
            SCAN2 -- "Yes" --> SKIP["skip — this is ai-superpower repo"]
            SKIP --> SCAN1
            SCAN2 -- "No" --> P1
        end

        subgraph PROJ ["── Per-project setup ──"]
            P1["print ▸ project-name"]

            P1 --> P2{"project/.ai symlink\n→ SCRIPT_DIR/.ai?"}
            P2 -- "Yes" --> P3["skip silently"]
            P2 -- "No / wrong / broken" --> P4["ln -sfn SCRIPT_DIR/.ai project/.ai\nprint ✓ .ai symlinked"]
            P3 --> P5
            P4 --> P5

            P5{".ai in project/.gitignore?"}
            P5 -- "Yes" --> P6["skip silently"]
            P5 -- "No" --> P7["append .ai  print ✓"]
            P6 --> P8
            P7 --> P8

            P8{"project/docs/ exists?"}
            P8 -- "Yes" --> P10
            P8 -- "No" --> TTY{"stdin is TTY?\n[ -t 0 ]"}
            TTY -- "No" --> WARN["print ⚠ no docs/ skipping\ncnt_no_docs++  return"]
            TTY -- "Yes" --> ASK["print: no docs/ — create it? [y/N]"]
            ASK -- "n / enter" --> SKIP2["print  skipped\ncnt_no_docs++  return"]
            ASK -- "y" --> MK["mkdir docs/\nprint ✓ created docs/"]
            MK --> P10

            P10{"docs/ai-context.md exists?"}
            P10 -- "No" --> P11["cp templates/ai-context.md\nprint ✓ created\ncnt_templated++"]
            P10 -- "Yes  marker on line 1" --> P12["cp templates/ai-context.md\nprint ✓ refreshed\ncnt_refreshed++"]
            P10 -- "Yes  no marker" --> P13["skip — developer owns file"]
            P11 --> P14
            P12 --> P14
            P13 --> P14

            P14{"docs/architecture.md exists?"}
            P14 -- "No" --> P15["cp templates/architecture.md\nprint ✓ created\ncnt_templated++"]
            P14 -- "Yes  marker on line 1" --> P16["cp templates/architecture.md\nprint ✓ refreshed\ncnt_refreshed++"]
            P14 -- "Yes  no marker" --> P17["skip — developer owns file"]
            P15 --> NEXT
            P16 --> NEXT
            P17 --> NEXT
            WARN --> SCAN1
            SKIP2 --> SCAN1
        end

        NEXT --> SCAN1
        SCAN1 -- "all projects done" --> S1

        subgraph SUMMARY ["── Summary + version file ──"]
            S1{"cnt_found > 0?"}
            S1 -- "No" --> S2["print ⚠ no projects found\nare you in the right directory?"]
            S1 -- "Yes" --> S3["print ✅ done"]
            S2 --> S4
            S3 --> S4
            S4["read PREV_COMMIT from .ai-superpower.version"]
            S4 --> S5["print:\nversion: prev → new\nprojects: N found\nno docs/: M skipped\ntemplated: X new\nrefreshed: Y updated"]
            S5 --> S6["write DEV_ROOT/.ai-superpower.version\ndate + commit hash"]
        end
    end