Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.
Python agentic-aiai-securityalert-triageblue-teamcybersecuritydetection-engineeringincident-responselanggraphllm-agentsmcpmitre-attackmodel-context-protocolpurple-teamsecurity-operationsself-hostedsiemsoarsocthreat-detectionthreat-intelligence
Bring install.ps1 to parity with install.sh, and stop the docs contradicting the README (#872)
Beenu Arora220d96e43ba8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 57a1b82bc..c3e3a3d0a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,52 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Added++- **`scripts/generate_corpus_stats.py`** — generates+ `apps/web/src/data/corpus-stats.json` + `corpusStats.ts` from the compiled+ engine ruleset, the generated detection truth table, and the marketplace+ index, reconciling all three against each other and refusing to publish if+ they disagree. Every landing surface imports the constants, so none can+ carry its own literal. `--check` is wired into `ci.yml :: python-lint`;+ `--self-test` hand-edits the artefact and requires the drift to be caught.+ The artefact keeps `executable` and `onDisk`/`quarantined` as separate+ fields, and the UI leads with the executable count.+- **`scripts/check_alert_reduction_claims.py`** — prose cannot be generated+ the way a count can, so the retraction is gated instead. No published+ surface may assert the legacy harness runs the production grouping; any+ surface quoting 75.3 % must carry the retraction; the `alert_reduction`+ suite card may not be declared `kind: 'measurement'`; and every surface+ publishing the real figure must quote `PUBLISHED_REDUCTION_PCT`, a new+ constant in `services/fusion/tests/test_alert_reduction_real.py` that the+ test asserts against its own measurement — so the chain from measurement+ to published prose has no hand-copied link. A paragraph that dates or+ negates the claim is exempt, so the retraction can quote the wording it+ retracts.+- **The prerequisites that were required but undocumented.** Beyond Docker and+ its memory, a first run needs `python3` **on the host** (`make smoke` runs+ the golden-pipeline script there, so without it you can start AiSOC but+ cannot prove it works), `bash` (`make up` gates on `scripts/doctor.sh+ --ports-only` before it calls compose), and roughly 18 GB of free Docker+ disk — previously implied only by a troubleshooting row noting that Kafka+ corrupts its log directory and *still passes its healthcheck* when the+ daemon runs out of space. Node 22 and pnpm 8, which the installers require,+ were also unlisted. All are now in the quick-start prerequisites table with+ the command each one gates.++### Changed++- **`readme_gates.py` covers the governance documents.** Its `FIGURE_DOCS`+ list named one compliance page, which is why `ROADMAP.md` drifted with CI+ green. `ROADMAP.md` and `RELEASES.md` are now on the list, the matrix+ **row total** is compared as well as the GATED/PARTIAL split, and a figure+ the prose explicitly dates ("the count at that time") is exempt so history+ need not be rewritten.+- **`check_scoreboard.py --check` verifies `agent_version` against+ `VERSION`.** `--refresh` already stamped it; nothing compared it, and the+ freshness gate reads only the date — which a refresh keeps current — so a+ row could be two days old and still labelled two majors behind.+### Fixed- **A retracted benchmark figure was still badged "Real measurement".**@@ -48,42 +94,74 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0fabricated logos, but four of them assert a partner count nothing in therepository supports, and the window closed in June 2026 while still beingadvertised as upcoming.--### Added--- **`scripts/generate_corpus_stats.py`** — generates- `apps/web/src/data/corpus-stats.json` + `corpusStats.ts` from the compiled- engine ruleset, the generated detection truth table, and the marketplace- index, reconciling all three against each other and refusing to publish if- they disagree. Every landing surface imports the constants, so none can- carry its own literal. `--check` is wired into `ci.yml :: python-lint`;- `--self-test` hand-edits the artefact and requires the drift to be caught.- The artefact keeps `executable` and `onDisk`/`quarantined` as separate- fields, and the UI leads with the executable count.-- **`scripts/check_alert_reduction_claims.py`** — prose cannot be generated- the way a count can, so the retraction is gated instead. No published- surface may assert the legacy harness runs the production grouping; any- surface quoting 75.3 % must carry the retraction; the `alert_reduction`- suite card may not be declared `kind: 'measurement'`; and every surface- publishing the real figure must quote `PUBLISHED_REDUCTION_PCT`, a new- constant in `services/fusion/tests/test_alert_reduction_real.py` that the- test asserts against its own measurement — so the chain from measurement- to published prose has no hand-copied link. A paragraph that dates or- negates the claim is exempt, so the retraction can quote the wording it- retracts.--### Changed--- **`readme_gates.py` covers the governance documents.** Its `FIGURE_DOCS`- list named one compliance page, which is why `ROADMAP.md` drifted with CI- green. `ROADMAP.md` and `RELEASES.md` are now on the list, the matrix- **row total** is compared as well as the GATED/PARTIAL split, and a figure- the prose explicitly dates ("the count at that time") is exempt so history- need not be rewritten.-- **`check_scoreboard.py --check` verifies `agent_version` against- `VERSION`.** `--refresh` already stamped it; nothing compared it, and the- freshness gate reads only the date — which a refresh keeps current — so a- row could be two days old and still labelled two majors behind.+- **The Windows installer routed evaluators to a stack that cannot answer the+ question they came to ask.** `install.sh` was changed to bring up the real+ deployment, create an administrator and verify the pipeline; `install.ps1`+ was not, and nothing noticed. It handed off to `pnpm aisoc:demo` — a compose+ file that opens by saying it does not run the AiSOC pipeline, has no ingest+ service and no fusion service, sets `AISOC_DISABLE_KAFKA=true`, and whose+ console content comes entirely from a seed script writing rows straight into+ Postgres — and then printed `AiSOC is up and running.` A Windows user saw a+ populated console and concluded the platform worked, having never run the+ platform. `install.ps1` now performs the stages `make up` and `make smoke`+ perform: a port pre-check that names the process holding a port rather than+ letting compose fail with `Bind for 0.0.0.0:5432 failed`, `docker compose+ up -d`, a wait that reads `docker compose ps -a` so an exited or+ crash-looping container fails rather than passing, `docker compose run --rm+ -T api python -m app.scripts.bootstrap_admin`, and the golden-pipeline+ runner. Windows has no `make` and the Makefile's recipes are POSIX shell, so+ these are native re-implementations of the same commands rather than a+ `make` call; `tests/test_installer_parity_gate.py` fails the build if the+ two installers diverge again.+- **No administrator was created on Windows, and the closing banner said+ nothing about credentials.** A Windows user either could not sign in at all+ or signed in to a seeded database and evaluated that as the product. The+ banner now surfaces the generated password the same way `install.sh` does:+ printed once, stored nowhere, with the reset command alongside it. It also+ no longer claims the pipeline was verified when the check was skipped for+ want of a Python interpreter.+- **`install.ps1` pointed at an uninstaller that does not exist.** The closing+ banner named `.\scripts\install\uninstall.ps1`; the file is `uninstall.ps1`+ at the repository root and has never been anywhere else, so the last+ instruction the installer gave a Windows user could not work. The parity+ gate now asserts every `.ps1` path either script tells a user to run is a+ file in the repository.+- **`uninstall.ps1` left the whole stack running while reporting success.** It+ tore down only `infra/compose/docker-compose.demo.yml`, so every CORE+ container — Postgres still holding 5432 — survived an uninstall that said it+ was complete. It now brings down the root `docker-compose.yml` project+ across every optional profile, then the demo project for anyone who ran the+ older installer.+- **`install.ps1` installed dependencies nobody tested.** It used+ `pnpm install --no-frozen-lockfile` where `install.sh` uses+ `--frozen-lockfile` for the stated reason that a self-hoster's install must+ not quietly resolve a dependency set CI never saw. It also accepted Node 20+ where `install.sh` requires 22, the version every workflow tests on and both+ Node images ship. Both now match, and the gate compares them.+- **The docs portal contradicted the README on whether the pipeline works.**+ `quickstart.md` was a pre-v8.2 page built around `pnpm aisoc:demo`; because+ the scripts it named still exist, nothing errored and it simply took readers+ to the wrong stack. Three statements were false. It claimed `.env.example`+ ships "a pre-generated dev `AISOC_CREDENTIAL_KEY`" — it ships a placeholder+ that is worse than an empty value, because an empty one makes the API+ generate an ephemeral key and warn while a malformed one makes the+ credential vault raise, so the first request touching a connector secret+ returns HTTP 500. It claimed events posted to `/v1/ingest/batch` "accept+ cleanly but never become `Alert` rows", which is the exact path `make smoke`+ asserts and the README publishes as its headline proof. And its cheat sheet+ offered `aisoc keygen` as the way to generate that vault key, when `aisoc+ keygen` writes an Ed25519 plugin-signing pair to `~/.aisoc/signing.key` and+ has nothing to do with Fernet. The page is now written around `make up`,+ `make bootstrap` and `make smoke`, and its compose-profile table was rebuilt+ from `docker-compose.yml` rather than corrected from the old text — six port+ numbers and profile memberships were wrong, and two whole profiles were+ missing.+- **`installation.md` documented flags that do not exist.** `-SkipDemo`,+ `AISOC_SKIP_DEMO` and `-AisocDir` are not accepted by either installer; the+ real spellings are `--no-launch` / `-NoLaunch` and `--clone-dir` /+ `-CloneDir`. The page also still promised a browser opening on a seeded+ ransomware case with pre-filled credentials, which no longer happens and for+ which there are no default credentials.## [10.0.0] — 2026-09-25diff --git a/apps/docs/docs/installation.md b/apps/docs/docs/installation.mdindex 5972c8dfb..114d92c79 100644--- a/apps/docs/docs/installation.md+++ b/apps/docs/docs/installation.md@@ -8,11 +8,12 @@ The fastest way to a running AiSOC dashboard, with **zero assumedprerequisites**, is the bootstrap installer. It works against afreshly-imaged machine — no Docker, Node, pnpm, git, or even Homebrewrequired up front. It detects your OS, installs everything idempotently,-clones the repo, and launches the demo stack with seeded data and a-mid-investigation case open in your browser.+clones the repo, starts the CORE stack, creates the first administrator,+and then pushes one real event through the pipeline to prove the+deployment works.-If you already have Docker + Node + pnpm and you want to skip straight to-the demo orchestrator, see the [Quick start](./quickstart). If you are+If you already have Docker + Node + pnpm and you want to run the same+three commands yourself, see the [Quick start](./quickstart). If you aredeploying to production, see [Deployment options](./deployment/docker).## TL;DR@@ -25,9 +26,10 @@ curl -fsSL https://raw.githubusercontent.com/beenuar/AiSOC/main/install.sh | basiwr -useb https://raw.githubusercontent.com/beenuar/AiSOC/main/install.ps1 | iex```-When the installer finishes, your default browser opens at-`http://localhost:3000/cases/INC-RT-001?tab=ledger` with the seeded-LockBit 3.0 ransomware investigation already in flight.+When the installer finishes, the CORE stack is running at+`http://localhost:3000`, an administrator exists whose generated password+was printed once during the run, and one real event has been pushed+through the pipeline and read back out of the API as an alert.## Supported platforms@@ -57,18 +59,23 @@ target component is already installed at a sufficient version.out and back in for the same install run.3. **Node.js 22 LTS** via the official NodeSource APT repo, the FedoraNodeJS module, the relevant native package on Arch / openSUSE /- Alpine, or `brew install node@20` on macOS.+ Alpine, or `brew install node@22` on macOS.4. **pnpm 8+** via `corepack enable && corepack prepare pnpm@latest`.5. **Homebrew** (macOS only) — bootstrapped non-interactively if itisn't already installed.6. **The AiSOC repo itself** — cloned to `$HOME/aisoc` (override with`AISOC_DIR=/path/to/clone`). On a re-run the installer does`git fetch && git pull` instead.-7. **`pnpm install`** at the repo root to materialise the workspace.-8. **`pnpm aisoc:demo`** — the existing one-shot orchestrator that- pulls the prebuilt `ghcr.io/beenuar/*` images, brings up the slim- demo profile, runs the seeder as a one-shot container, kicks off- an investigation, and opens your browser at the live case.+7. **`pnpm install --frozen-lockfile`** at the repo root to+ materialise the workspace.+8. **`make up`** — checks the ports, brings up the CORE stack from the+ root `docker-compose.yml`, waits for every container to report+ healthy, and creates the first administrator, printing its+ generated password once.+9. **`make smoke`** — posts one real event to the ingest API and+ follows it through Kafka, detection, correlation and Postgres, then+ reads the resulting alert back out of the public API. If that+ fails, the install has failed, whatever the containers say.### Windows (`install.ps1`)@@ -88,28 +95,35 @@ target component is already installed at a sufficient version.5. **Node.js 22 LTS** via `winget install --id OpenJS.NodeJS.LTS`.6. **pnpm 8+** via `corepack enable && corepack prepare pnpm@latest`.7. **The AiSOC repo** — cloned to `$env:USERPROFILE\aisoc` (override- with `-AisocDir 'C:\path\to\clone'`).-8. **`pnpm install`** + **`pnpm aisoc:demo`** as on Linux/macOS.+ with `-CloneDir 'C:\path\to\clone'`).+8. **`pnpm install --frozen-lockfile`**, then the same three stages+ `make up` and `make smoke` perform on Linux and macOS. Windows has+ no `make`, so `install.ps1` runs them natively — the port+ pre-check, `docker compose up -d` with a wait for every container+ to report healthy, `docker compose run --rm -T api python -m+ app.scripts.bootstrap_admin`, and the golden-pipeline runner. Same+ stack, same administrator, same proof.## Common cases### "I already have everything installed"That's fine. The installer is idempotent — it detects existing-sufficient versions and skips them. The end state is the same: a-running demo with `INC-RT-001` open in your browser.+sufficient versions and skips them. The end state is the same: a running+CORE stack that has demonstrably processed an event.### "I want to install into a different directory"```bash# Linux/macOS — clone to ~/work/aisoc instead of ~/aisoc:-AISOC_DIR=$HOME/work/aisoc bash <(curl -fsSL https://raw.githubusercontent.com/beenuar/AiSOC/main/install.sh)+curl -fsSL https://raw.githubusercontent.com/beenuar/AiSOC/main/install.sh -o install.sh+bash install.sh --clone-dir "$HOME/work/aisoc"``````powershell# Windows — clone to D:\src\aisoc instead of $HOME\aisoc:iwr -useb https://raw.githubusercontent.com/beenuar/AiSOC/main/install.ps1 -OutFile $env:TEMP\aisoc-install.ps1-& $env:TEMP\aisoc-install.ps1 -AisocDir 'D:\src\aisoc'+& $env:TEMP\aisoc-install.ps1 -CloneDir 'D:\src\aisoc'```### "I want to run the script after reading it"@@ -133,21 +147,22 @@ notepad install.ps1 # read it.\install.ps1```-### "I want to skip the demo launch and just install dependencies"+### "I want to skip the launch and just install dependencies"```bash# Linux/macOS:-AISOC_SKIP_DEMO=1 bash install.sh+bash install.sh --no-launch# Windows:-.\install.ps1 -SkipDemo+.\install.ps1 -NoLaunch```-The repo is still cloned and `pnpm install` still runs, but-`pnpm aisoc:demo` is skipped so you can manually configure `.env` /-secrets / connectors before the first stack startup.+The repo is still cloned and `pnpm install` still runs, but the stack is+not started, no administrator is created and the pipeline check does not+run — so you can configure `.env` / secrets / connectors before the first+startup. Both scripts print the commands to run afterwards.-### "I want to redirect the demo to a different host or port"+### "I want to redirect the stack to a different host or port"Edit `.env` after the clone step. The relevant variables are documentedinline in `.env.example` and in@@ -155,10 +170,10 @@ inline in `.env.example` and in## Uninstall-Both installers ship with a matching uninstaller, also at the repo root.-They are graduated — by default they only stop the demo stack and drop-its named volumes, leaving Docker Desktop, Node, pnpm, and the repo-untouched. Pass flags to escalate.+Both installers ship with a matching uninstaller, also at the repo root+(`uninstall.sh` and `uninstall.ps1`). They are graduated — by default+they only stop the stack and drop its named volumes, leaving Docker+Desktop, Node, pnpm, and the repo untouched. Pass flags to escalate.| Action | Linux / macOS | Windows ||--------|----------------|---------|@@ -200,21 +215,35 @@ Docker Desktop will use it. If Docker Desktop still complains, open`Settings → General` and confirm "Use the WSL 2 based engine" isticked, then `wsl --update` and restart Docker Desktop.-### Browser didn't open+### I can't sign in-Visit-[`http://localhost:3000/cases/INC-RT-001?tab=ledger`](http://localhost:3000/cases/INC-RT-001?tab=ledger)-manually. Default credentials are pre-filled (`[email protected]`); the-investigation is already in flight on the **Ledger** tab.+There are no default credentials. The installer creates+`[email protected]` with a password generated on your machine and+printed once, at the end of the run — it is stored nowhere. If the+terminal has already scrolled away, mint a new one:-### `aisoc:demo` is already running+```bash+make bootstrap ARGS=--reset-password+```++```powershell+docker compose run --rm -T api python -m app.scripts.bootstrap_admin --reset-password+```-The orchestrator is idempotent — re-running `pnpm aisoc:demo` against-a healthy stack is a no-op. To get a fully clean start:+### The stack is already running++Both installers are idempotent — re-running one against a healthy stack+starts nothing new and reports the administrator that already exists. To+get a fully clean start:```bash-pnpm aisoc:demo:down # stop stack + drop volumes-pnpm aisoc:demo # bring it back up + reseed+make clean # stop the stack and delete all volumes+make up # bring it back up+```++```powershell+docker compose down -v+.\install.ps1 -NoInstall```### Anything else@@ -231,7 +260,7 @@ file an issue with the installer's full output —only for package-manager calls on Linux. macOS Homebrew prompts fora password the first time it touches `/opt/homebrew` or `/usr/local`.- The Linux script does **not** disable SELinux, AppArmor, or your- firewall. The demo binds only to `127.0.0.1`, so nothing is exposed+ firewall. The stack binds only to `127.0.0.1`, so nothing is exposedto your LAN by default.- The Windows script enables WSL2 and starts Docker Desktop. It does**not** join AD, change Defender settings, or reconfigure Windows@@ -247,7 +276,7 @@ file an issue with the installer's full output —## What's next-- [Quick start](./quickstart) — the underlying `pnpm aisoc:demo` flow + full developer stack+- [Quick start](./quickstart) — the underlying `make up` / `make smoke` flow + full developer stack- [Architecture](./architecture) — how the services in the demo wire together- [Connect your first source](./connectors) — point AiSOC at a real EDR / SIEM / cloud- [Operations: Credentials](./operations/credentials) — credential vault key & rotationdiff --git a/apps/docs/docs/quickstart.md b/apps/docs/docs/quickstart.mdindex 803ad0048..2af367bf2 100644--- a/apps/docs/docs/quickstart.md+++ b/apps/docs/docs/quickstart.md@@ -4,154 +4,254 @@ sidebar_position: 3# Quick Start-Four paths to a running AiSOC instance, in increasing order of how much you-already have installed:--0. **Zero-prerequisite bootstrap** — one shell command from a freshly-imaged- machine. Installs Docker, Node, pnpm, git, and clones the repo; then runs- Path A automatically. See [One-click install](./installation).-1. **One-shot demo** — `pnpm aisoc:demo` brings up a slim stack from prebuilt- GHCR images, seeds canonical demo data, kicks off an investigation, and- opens your browser at the live case. Roughly 3-4 minutes on a warm Docker- daemon.-2. **Full development stack** — every microservice (UEBA, Honeytokens, Purple- Team, ClickHouse, OpenSearch, Neo4j, Qdrant, MCP, osquery TLS server,- Slack bot) for hacking on AiSOC itself.-3. **Founder-style CLI** — the same dev stack as Path B, but driven entirely- through the `aisoc` CLI: `aisoc serve`, `aisoc db upgrade`, `aisoc submit`,- `aisoc mcp serve`. Ideal for screen-recording demos and for operators who- prefer a single binary over `docker compose` + `alembic` + `curl`.--This page covers Paths A, B, and C. If you don't have Docker / Node / pnpm-yet, or if you just want a guaranteed-clean environment in one command, start-with [Path 0 (One-click install)](./installation).+Three commands take a fresh clone to a running AiSOC that has demonstrably+processed an event:-## Prerequisites+```bash+git clone https://github.com/beenuar/AiSOC.git && cd AiSOC+cp .env.example .env+make up+make smoke+```-| Tool | Minimum version | Required for |-|------|-----------------|--------------|-| Docker & Docker Compose | v2.x | Both paths |-| Node.js | ≥ 20 LTS | Both paths |-| pnpm | ≥ 8 | Both paths |-| Python | 3.11+ | Eval harness, dev stack only |-| Go | 1.25+ | Only if hacking on Go services or plugins |+`make up` starts the CORE stack and finishes by creating an administrator.+`make smoke` posts one real event to the ingest API and follows it through+Kafka, detection, correlation and Postgres, then reads the resulting alert+back out of the public API. That second command is the one that matters: a+console with data in it is not evidence that the pipeline works, and until+`make smoke` passes you have not seen the product run.-> If you don't have all of the above, just use the-> [One-click installer](./installation) — it installs every prerequisite-> idempotently for Linux, macOS, and Windows, then runs Path A for you.+The rest of this page is the same journey with the detail filled in, plus two+other ways to drive the same services.-## Path A — one-shot demo+| Path | What it is |+| --- | --- |+| **A** | The canonical path above — CORE stack, administrator, pipeline proof. |+| **B** | CORE plus the lake, graph, vector store, search and enrichment, for hacking on AiSOC itself. |+| **C** | The same services driven through the `aisoc` CLI instead of `make` + `curl`. |++If you have none of the prerequisites below, or you just want a+guaranteed-clean environment in one command, start with the+[one-click installer](./installation) — it installs every prerequisite+idempotently on Linux, macOS and Windows and then runs Path A for you.++## Prerequisites++| Requirement | Minimum | Needed for |+|---|---|---|+| Docker + Compose v2 | v2.x | everything |+| RAM available to Docker | **6.5 GB** (CORE) · 12 GB (`full`) | `make up` · `make up-full` |+| Free Docker disk | **~18 GB** | `make up` |+| `bash` | any | `make up` — its pre-flight port check is a shell script |+| `python3` | 3.11+ | `make smoke`, `make stats`, the eval harness |+| Node.js | 22 LTS | `install.sh` / `install.ps1`, and building the web console |+| pnpm | ≥ 8 | as above |+| Go | 1.25+ | only if you are hacking on the Go services or plugins |++Three of those are easy to miss, because nothing names them until the command+that needs them fails:++- **`bash`.** `make up` runs `scripts/doctor.sh --ports-only` before it calls+ compose, so a port conflict is reported against the process holding the+ port rather than as a `Bind for 0.0.0.0:5432 failed` against whichever+ container lost the race. It is a hard gate: no bash, no `make up`.+- **`python3` on the host**, not just in the containers. `make smoke` runs+ `tests/e2e/golden_pipeline/run_golden_pipeline.py` on your machine, against+ the stack's published ports. Without it you can start AiSOC but you cannot+ prove it works.+- **Free Docker disk.** Below roughly 18 GB the images and volumes do not+ comfortably fit, and the failure is quiet rather than loud: Kafka corrupts+ its log directory and *still passes its healthcheck*, so the stack reports+ green while nothing flows. `make doctor` checks the space you have and says+ whether it is enough.++Windows has no `make`. `install.ps1` runs the same steps natively — see+[one-click install](./installation).++## Path A — run it, then prove it works++### 1. Clone and configure```bashgit clone https://github.com/beenuar/AiSOC.gitcd AiSOC-pnpm aisoc:demo+cp .env.example .env```-That single command:+`.env.example` ships a working `POSTGRES_PASSWORD` (`aisoc_dev_secret`), so+the database comes up without you touching anything.-1. Pulls prebuilt images from `ghcr.io/beenuar/*` (≈90s on a warm cache).-2. Brings up the slim demo profile defined in- [`infra/compose/docker-compose.demo.yml`](https://github.com/beenuar/AiSOC/blob/main/infra/compose/docker-compose.demo.yml):- `postgres`, `redis`, `kafka`, `api`, `agents`, `realtime`, `web`.-3. Waits for healthchecks to go green.-4. Seeds canonical demo data (tenants, users, alerts, IOCs, attack paths).-5. Kicks off an AI investigation against a seeded case.-6. Opens your browser at `/cases/<uuid>` so you land on a **live** investigation.+**It does not ship a usable `AISOC_CREDENTIAL_KEY`.** The line you copy is:-| Step | Approximate time |-|---|---|-| `docker compose pull` | ~90s |-| `docker compose up` + healthchecks | ~60s |-| Seed canonical data | ~30s |-| Kick off investigation | ~30s |-| Total | ~3.5 min |+```bash+AISOC_CREDENTIAL_KEY=replace-me-with-a-freshly-generated-fernet-key+```-When you're done:+That placeholder is not a Fernet key, and it is worse than leaving the+variable empty: an unset key makes the API generate an ephemeral one and warn,+while a malformed key makes the credential vault raise, so the first request+that touches a connector secret returns HTTP 500. Generate a real one and+paste it in before you go near the Connectors page:```bash-pnpm aisoc:demo:down # stops the stack and deletes the demo volumes-pnpm aisoc:demo:logs # tails logs while the stack is up+python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"```-The orchestrator script lives at-[`scripts/aisoc-demo.ts`](https://github.com/beenuar/AiSOC/blob/main/scripts/aisoc-demo.ts).+Nothing in Path A needs it — the pipeline proof below does not touch the+vault — so you can also come back to this when you connect your first source.+Full threat model and rotation procedure:+[Operations: Credentials](./operations/credentials).-### Acceptance gate+AI triage additionally needs a provider key (`OPENAI_API_KEY` or+`ANTHROPIC_API_KEY`). Without one the stack still boots and every alert is+triaged by the deterministic path, and the console labels it as such —+nothing pretends the AI ran.-The buyer-value contract for v1.0 is **clone-to-investigation in ≤ 5 minutes on-a clean Mac**. We measure it with a dedicated harness:+### 2. Start the stack```bash-pnpm aisoc:acceptance # warm start, default 5-minute budget-pnpm aisoc:acceptance --cold # prune cached demo images first (true clean clone)-pnpm aisoc:acceptance --history-only # print the trend ledger+make up```-The harness wraps `aisoc:demo`, enforces the budget, and appends a JSONL entry-to `.aisoc/acceptance-history.jsonl` per run so regressions are visible across-commits. Exit codes — `0` pass, `3` over budget, `4` showcase case never-reached — make it easy to wire into CI without parsing logs. Source:-[`scripts/aisoc-acceptance.ts`](https://github.com/beenuar/AiSOC/blob/main/scripts/aisoc-acceptance.ts).+This checks the ports first, starts the CORE profile, waits for every+container to report healthy, and then creates the first administrator. A+container that exited or is crash-looping fails the wait rather than passing+it, so `make up` returning 0 means the services are actually up.-## Path B — full development stack+```+ Console: http://localhost:3000+ API: http://localhost:8000/api/docs+```-Use this when you want to hack on AiSOC itself, run the eval harness, or-exercise UEBA / Honeytokens / Purple Team / MCP.+### 3. Prove the pipeline works++```bash+make smoke+```++```+[PASS] raw telemetry accepted by ingest+[PASS] event traversed the spine and became an alert+[PASS] alert is retrievable by id from the API+```++The runner POSTs a single suspicious-PowerShell event to+`http://localhost:8081/v1/ingest/batch` and then observes every stage from+the outside — Kafka, fusion, detection, promotion, Postgres, and finally the+public API. It does not insert an alert, stub Kafka or reach into fusion's+internals, because a test that reaches past a component cannot tell you that+component works. Each stage reports PASS or FAIL independently, so a break+names the boundary that broke.++The alert title carries a fresh run id every time, so a re-run cannot pass by+finding the previous run's alert.++If a stage fails, `make doctor` diagnoses every dependency and prints the+command that investigates each one.-### 1. Clone & configure+### 4. Sign in++Open [http://localhost:3000](http://localhost:3000).++There are no default credentials. `make up` runs `make bootstrap`, which+creates `[email protected]` with a password generated on your machine and+printed once — it is stored nowhere, so copy it when you see it. If the+terminal has already scrolled away, mint a new one:```bash-git clone https://github.com/beenuar/AiSOC.git-cd AiSOC-cp .env.example .env-pnpm install+make bootstrap ARGS=--reset-password```-Open `.env` and fill in at least one AI provider:+To choose the address, or supply your own password instead:```bash-# AI providers (at least one required)-OPENAI_API_KEY=sk-...-# or-ANTHROPIC_API_KEY=sk-ant-...[email protected] make bootstrap+printf '%s' "$MY_PASSWORD" | docker compose run --rm -T api \+ python -m app.scripts.bootstrap_admin --password-stdin+```-# API JWT signing key — generate with: openssl rand -hex 32-SECRET_KEY=change-me-in-production-at-least-32-chars+The address has to be one the login route accepts. It is validated with the+same library the API uses, so reserved domains (`.local`, `.test`, `.invalid`,+`.localhost`) are refused here with an explanation rather than producing an+account that fails at the login form with a schema error.-# Optional enrichment / feeds / SSO / Purple Team — see .env.example+The mobile **Responder PWA** lives at+[http://localhost:3000/responder](http://localhost:3000/responder) — install+it on your phone via "Add to Home Screen" and sign in with a passkey.++### 5. Look around with synthetic data++```bash+make demo```-### 2. Start the full stack+Loads a synthetic dataset so the console has something to show before you+connect a real source. Every row it writes is marked `is_synthetic = true` in+the database and labelled in the console. It is not a benchmark, a customer,+or a real incident.-Most of the services below are behind a compose profile, so a bare-`docker compose up -d` starts neither UEBA nor Honeytokens nor Purple Team.-Name the profiles you want:+### Day-to-day commands++| Command | What it does |+| --- | --- |+| `make status` | every service and its health |+| `make logs` | follow logs (`SERVICE=fusion` to narrow) |+| `make doctor` | diagnose every dependency, with the fix for each |+| `make smoke` | re-run the end-to-end pipeline check |+| `make down` | stop the stack, keep the data |+| `make clean` | stop the stack and delete all volumes |++:::caution Not the same thing as `pnpm aisoc:demo`+`infra/compose/docker-compose.demo.yml` — what `pnpm aisoc:demo` starts — is a+UI preview over a pre-seeded database. It has no ingest service and no fusion+service, and it sets `AISOC_DISABLE_KAFKA=true`: everything visible in that+console came from a seed script writing rows straight into Postgres. Use it to+look at the interface. Do not use it to decide whether AiSOC works, because it+cannot answer that question. `make up` is the stack this page, the README and+CI all mean.+:::++## Path B — the full stack++Use this when you want to hack on AiSOC itself, run the eval harness, or+exercise UEBA / Honeytokens / Purple Team / MCP.```bash-docker compose --profile full --profile extras up -d-docker compose --profile full --profile extras ps+make up-full```-That starts:+That starts CORE plus the event lake, entity graph, vector store, search and+enrichment, sets the lake and graph writers on (they target stores that only+exist in this profile), and waits for every container to report healthy.++### What is in which profile++Most non-CORE services sit behind a compose profile, so a bare+`docker compose up -d` starts neither UEBA nor Honeytokens nor Purple Team.+`make up` and `make up-full` are the supported spellings for the first two+rows, and additionally wait for health, which a bare `docker compose up -d`+does not.| Profile | Services || --- | --- |-| *(default)* | **PostgreSQL** (5432) · **Redis** (6379) · **Kafka** (9092) · **litellm** (4000, LLM gateway) · **api** (8000, FastAPI core) · **agents** (8001, LangGraph) · **realtime** (8086, Node.js + VAPID Web Push) · **web** (3000) · **fusion** (8003) · **ingest** (8081, Go) |-| `full` | **ClickHouse** · **OpenSearch** · **Neo4j** · **Qdrant** · **kafka-ui** (8080) · **actions** (8002) · **threatintel** (8005) · **ueba** (8007) · **enrichment** (8080, Go) · **connectors** (8003) |+| *(default — CORE)* | **postgres** (5432) · **redis** (6379) · **zookeeper** · **kafka** (9092) · **litellm** (4000, LLM gateway) · **ingest-worker** (8081, Go) · **fusion** (8003) · **api** (8000) · **agents** (8001) · **realtime** (8086) · **web** (3000) |+| `full` | **clickhouse** (8123/9000) · **neo4j** (7474/7687) · **qdrant** (6333) · **opensearch** (9200) · **threatintel** (8005) · **ueba** (8007) · **connectors** (8088) · **enrichment** (8080, Go) · **kafka-ui** (8090) · **actions** (8002) || `extras` | **honeytokens** (8008) · **purple-team** (8006) |+| `chatops` | **slack-bot** (8009) · **actions** (8002) |+| `monitoring` | **prometheus** (9091) · **grafana** (3001) · **alertmanager** (9094) · **tempo** (3200) · **otel-collector** (4317/4318) || `osquery` | **osquery-tls** (8091) |-`make up` and `make up-full` are the supported spellings for the first two-rows and additionally wait for every container to report healthy, which a-bare `docker compose up -d` does not.--**What this gives you about AI.** Every command above starts the CORE-profile, which includes the `litellm` LLM gateway. AiSOC asks for logical task-aliases (`aisoc-triage`, `aisoc-investigation`, …) and the gateway is the only-thing that resolves them, so it has to be running for AI triage to happen at-all — it was a `full`-profile service until 2026-09, which meant the default-install could not do AI triage even with the key you just set+CORE is 11 services and `full` is 21 — `actions` is in both `full` and+`chatops`, so it is counted once. Named profiles compose, so+`docker compose --profile full --profile extras up -d` is valid; it just does+not wait for health the way `make up-full` does.++**What this gives you about AI.** Every command above starts the CORE profile,+which includes the `litellm` LLM gateway. AiSOC asks for logical task aliases+(`aisoc-triage`, `aisoc-investigation`, …) and the gateway is the only thing+that resolves them, so it has to be running for AI triage to happen at all —+it was a `full`-profile service until 2026-09, which meant the default install+could not do AI triage even with the key you set([ADR-0006](https://github.com/beenuar/AiSOC/blob/main/docs/decisions/0006-llm-gateway-in-core.md)).- **With a provider key** in `.env`: alerts are triaged by the AI, and the@@ -161,11 +261,7 @@ install could not do AI triage even with the key you just setLLM call is made. Every alert is triaged by the deterministic path and theconsole labels it as such. Nothing pretends the AI ran.-Path A above needs no gateway: the demo compose pins every role to a concrete-provider model, and a concrete pin goes straight to the provider rather than-through the gateway.--### 3. Database migrations — nothing to run+### Database migrations — nothing to runEvery schema is applied by the stack itself; there is no manual migrationstep, and there is nothing to remember to run in the right order.@@ -208,29 +304,7 @@ A service whose chain did not reach head does not serve at all: itscontainer exits and `docker compose ps` shows it unhealthy rather thanrunning.-The `api` migrations include-[`008_investigation_ledger.sql`](https://github.com/beenuar/AiSOC/blob/main/services/api/migrations/008_investigation_ledger.sql)-(replayable agent decision log) and-[`009_responder_pwa.sql`](https://github.com/beenuar/AiSOC/blob/main/services/api/migrations/009_responder_pwa.sql)-(passkeys, on-call rotation, approvals).--### 4. Seed demo data--```bash-pnpm seed:demo-```--### 5. Verify--```bash-pnpm aisoc:doctor-```--Runs a one-shot health check across ports, containers, demo data, the API,-and the WebSocket gateway. If anything is red, it tells you exactly what to-fix.--### 6. Run the public eval harness (optional)+### Run the public eval harness (optional)```bash# Run all four substrate eval suites against the bundled 200-incident@@ -255,48 +329,17 @@ CI on every PR — see> [eval harness page](./benchmark) documents exactly what each suite measures> and what it doesn't.-### 7. Open the UI--Visit [http://localhost:3000](http://localhost:3000) and log in with the-credentials `make up` printed.--There are no default credentials. `make up` runs `make bootstrap`, which-creates `[email protected]` with a password generated on your machine and-printed once — it is stored nowhere, so copy it when you see it. If the-terminal has already scrolled away, mint a new one:--```bash-make bootstrap ARGS=--reset-password-```--To choose the address or supply your own password instead:--```bash[email protected] make bootstrap-printf '%s' "$MY_PASSWORD" | docker compose run --rm -T api \- python -m app.scripts.bootstrap_admin --password-stdin-```--The address has to be one the login route accepts. It is validated with the-same library the API uses, so reserved domains (`.local`, `.test`, `.invalid`,-`.localhost`) are refused here with an explanation rather than producing an-account that fails at the login form with a schema error.--The mobile **Responder PWA** lives at-[http://localhost:3000/responder](http://localhost:3000/responder) — install-it on your phone via "Add to Home Screen" and sign in with a passkey.+### Connect your first source in 5 minutes-### 8. Connect your first source in 5 minutes+Pointing AiSOC at a live source takes about five minutes per connector and+zero code changes. Connectors are a `full`-profile service, so start the stack+with `make up-full`.-The seeded demo data is enough to fly the UI through; pointing AiSOC at a-live source takes about five minutes per connector and zero code changes:--1. Generate a vault key and put it in `.env` —- `python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"`- then set `AISOC_CREDENTIAL_KEY=<that-string>`. In dev the API will- bootstrap an ephemeral key if you skip this; in prod the API refuses- to start without one. Full threat model and rotation procedure:- [Operations: Credentials](./operations/credentials).+1. Put a real Fernet key in `.env` as `AISOC_CREDENTIAL_KEY` (see+ [Clone and configure](#1-clone-and-configure) above) — connector+ credentials are encrypted with it. In development the API will bootstrap+ an ephemeral key if the variable is *empty*; it will not if the variable+ holds the placeholder `.env.example` ships.2. Restart the `api` and `connectors` services so they pick up the key.3. In the console, click **Connectors** → **Add connector**, pick asource from the catalog (Microsoft Entra, GCP Cloud Audit, GitHub, …@@ -318,7 +361,7 @@ Each per-connector page (e.g.(Azure AD app, GCP service account, GitHub fine-grained PAT) with exactpermissions / scopes / role assignments and a troubleshooting section.-### Console Tour+### Console tour| Page | URL | Description ||------|-----|-------------|@@ -326,26 +369,27 @@ permissions / scopes / role assignments and a troubleshooting section.| Alerts | `/alerts` | Raw signal feed with Ambient Copilot suggestions || Cases | `/cases` | Unified case management || Case workspace | `/cases/<id>` | Evidence timeline + **Investigation Ledger** + attack graph |-| Detections | `/detections` | Sigma/YARA/KQL rule catalog (800 native + ~6,000 imported, filterable by tier) |-| Playbooks | `/playbooks` | SOAR automation builder (50+ packs) |+| Detections | `/detections` | Sigma/YARA/KQL rule catalog, filterable by tier |+| Playbooks | `/playbooks` | SOAR automation builder || UEBA | `/ueba` | User behavior anomaly timeline || Honeytokens | `/honeytokens` | Deceptive token lifecycle || Purple Team | `/purple-team` | ATT&CK coverage · emulation runs · tabletop |-| Marketplace | `/marketplace` | 15 plugins + 50+ playbooks + 6,900+ detections (tier-filtered) |+| Marketplace | `/marketplace` | Plugins, playbooks and detection packs (tier-filtered) || Benchmark | `/benchmark` | Public eval harness — alert reduction + substrate self-consistency gates || Compliance | `/compliance` | SOC 2, ISO 27001, NIST CSF, PCI-DSS, HIPAA, DORA || Audit Log | `/audit` | Immutable, tenant-scoped activity ledger || Responder PWA | `/responder` | Mobile passkey-only console for on-call analysts |+Run `make stats` to recount the figures the README publishes — detection+counts and connector counts are produced from the tree rather than typed in,+so this page does not restate them.+## Path C — founder-style CLI-Same backing services as Path B (full dev stack), but every step is one-`aisoc <verb>` command. This is the path the recorded product demo follows-and the fastest way to go from "fresh clone" to "alert submitted, agent-investigating" without remembering the `docker compose` / `alembic` /-`curl` invocations.+The same services as Path A and B, driven through `aisoc <verb>` instead of+`make` + `curl`. This is the path the recorded product demo follows.-### 1. Clone & install the CLI+### 1. Install the CLI```bashgit clone https://github.com/beenuar/AiSOC.git@@ -356,9 +400,9 @@ python -m venv .venv && source .venv/bin/activatepip install -e packages/aisoc-cli```-`.env.example` is already wired up with a working `POSTGRES_PASSWORD` and a-pre-generated dev `AISOC_CREDENTIAL_KEY`. Add at least one AI provider key-(`OPENAI_API_KEY` or `ANTHROPIC_API_KEY`) before continuing.+Set `AISOC_CREDENTIAL_KEY` to a generated Fernet key as described in+[Clone and configure](#1-clone-and-configure), and add at least one AI+provider key (`OPENAI_API_KEY` or `ANTHROPIC_API_KEY`) if you want AI triage.Confirm the CLI is on PATH:@@ -376,9 +420,8 @@ aisoc serve```Under the hood this runs `docker compose -f infra/compose/docker-compose.dev.yml up -d`-against the full dev profile (Postgres, Redis, Kafka, ClickHouse, api,-agents, fusion, ingest-worker, web, mcp, …). The command resolves the repo-root automatically, so it works from any subdirectory.+against the dev profile. The command resolves the repo root automatically, so+it works from any subdirectory.Use `aisoc serve --no-detach` if you want to watch the logs inline, or run`docker compose ps` separately to confirm every container is healthy.@@ -427,14 +470,22 @@ A non-zero exit code means the API service rejected the payload orisn't reachable; the error message tells you to run `aisoc serve` firstif the latter.-Why direct-to-API instead of via the ingest spine? The Kafka-based-detection / correlation pipeline is still wiring up in the demo-environment, so events POSTed to `/v1/ingest/batch` accept cleanly but-never become `Alert` rows. The `/api/v1/alerts/submit` endpoint-short-circuits that gap so the recorded demo's "submit → see in console"-moment works on a fresh clone today. Production deployments still flow-events through `services/ingest` → Kafka → fusion → detection; this-endpoint is for fixtures and tabletop exercises.+#### `alerts/submit` versus the ingest spine++Both work, and they answer different questions.++`POST /v1/ingest/batch` on the **ingest** service is the production path:+normalize → Kafka → fusion → detection → correlation → an `Alert` row. That+is what `make smoke` exercises and what the README uses as its proof, so it is+the one to use when the question is "does the pipeline work".++`POST /api/v1/alerts/submit` on the **api** service short-circuits that and+writes the alert directly. It is the right tool for fixtures, tabletop+exercises and demo scripts, where you want a specific alert to exist without+waiting on the spine — and it is what the CLI uses so a single fixture lands+deterministically. It is not a fallback for a broken pipeline: if events sent+to the ingest spine are not becoming alerts, that is a defect, and+`make doctor` plus `make smoke` will localise it.#### Hardening / limits on `POST /api/v1/alerts/submit`@@ -479,17 +530,15 @@ sessions) on the alerts board.### 6. Hook your IDE in over MCP (optional)-If you use Cursor, Claude Desktop, or Continue, point them at the local-MCP server so you can talk to your running AiSOC instance from the editor:+If your editor speaks MCP, point it at the local MCP server so you can talk to+your running AiSOC instance from the editor:```bash-# Stand up the MCP server over stdio (Cursor / Claude / Continue)+# Stand up the MCP server over stdioaisoc mcp serve --transport stdio# Or auto-wire it into a specific IDE config-aisoc mcp install --host cursor-aisoc mcp install --host claude-aisoc mcp install --host continue+aisoc mcp install --host <editor>````aisoc mcp serve` prefers the local TypeScript build at@@ -516,10 +565,15 @@ sample exports to dogfood your detection content end to end.| Apply DB migrations | `aisoc db upgrade` || Submit a sample alert | `aisoc submit examples/alerts/lateral-movement.json` || Run the MCP server over stdio | `aisoc mcp serve --transport stdio` |-| Wire MCP into Cursor / Claude / Continue | `aisoc mcp install --host <host>` |+| Wire MCP into an editor | `aisoc mcp install --host <editor>` || Validate a plugin manifest | `aisoc plugin validate plugins/<id>` || Validate a Sigma rule | `aisoc detection validate detections/<id>.yml` |-| Generate a vault `AISOC_CREDENTIAL_KEY` | `aisoc keygen` |+| Generate an **Ed25519 plugin-signing** key pair | `aisoc keygen` |++`aisoc keygen` writes `~/.aisoc/signing.key` and `signing.pub` for signing+plugin manifests. It does **not** generate the vault's+`AISOC_CREDENTIAL_KEY`, which is a Fernet key — use the `python -c` one-liner+in [Clone and configure](#1-clone-and-configure) for that.## Next Steps@@ -553,6 +607,8 @@ sample exports to dogfood your detection content end to end.### Got stuck?-If `pnpm aisoc:demo` failed, healthchecks went red, or migrations didn't run cleanly,-the [troubleshooting page](./operations/troubleshooting) has runbooks for the most+Run `make doctor` first — it checks every dependency and prints the command+that investigates each failure. If `make up` never went healthy or `make+smoke` failed a stage, the+[troubleshooting page](./operations/troubleshooting) has runbooks for the mostcommon failure modes.diff --git a/install.ps1 b/install.ps1index 3bc282f0d..5b12fa270 100644--- a/install.ps1+++ b/install.ps1@@ -20,22 +20,49 @@reuses it (if you ran .\install.ps1 from inside a clone).5. Creates a .env from .env.example so the first boot has sanedefaults.- 6. Runs `pnpm install` to fetch the orchestrator's Node deps.- 7. Hands off to `pnpm aisoc:demo`, which pulls prebuilt images,- brings up the slim demo profile, seeds the showcase ransomware- case, and opens your browser at the case ledger view.+ 6. Runs `pnpm install --frozen-lockfile` to fetch the workspace's+ Node deps.+ 7. Starts the CORE stack with `docker compose up -d` and waits for+ every container to report healthy.+ 8. Creates the first administrator and prints its generated password+ once.+ 9. Pushes one real event through the pipeline and verifies it comes+ back out of the API as an alert.++ Steps 7-9 are what `make up` and `make smoke` do on Linux and macOS.+ They are re-implemented here rather than invoked because Windows has no+ `make`, and the Makefile's recipes are POSIX shell (`seq`, `awk`,+ `./scripts/doctor.sh`) that GNU Make on Windows would hand to cmd.exe.+ The commands underneath are identical — `docker compose up -d`,+ `docker compose run --rm -T api python -m app.scripts.bootstrap_admin`,+ `python tests/e2e/golden_pipeline/run_golden_pipeline.py` — so the two+ installers start the same stack and prove it the same way. Anything that+ changes in the Makefile's `up`, `bootstrap` or `smoke` targets has to+ change here too; `tests/test_installer_parity_gate.py` fails the build+ if it does not.++ What this script does NOT do is hand off to `pnpm aisoc:demo`. That+ starts a different compose file with no ingest service, no fusion+ service and Kafka disabled, whose only content is a seed script writing+ rows straight into Postgres. It is a UI preview, not a deployment, and+ an evaluator who saw a populated console there would conclude the+ platform worked without ever having run it..PARAMETER NoInstallSkip the dependency-install phase (use what's on PATH)..PARAMETER NoLaunch- Set everything up but don't run pnpm aisoc:demo at the end.+ Set everything up but don't start the stack, create the administrator+ or run the pipeline check..PARAMETER NoPull- Forwarded to aisoc:demo to skip image pull.+ Accepted for backwards compatibility and ignored with a warning.+ `docker compose up -d` only pulls images it does not already have, so+ there is no pull step left to skip..PARAMETER Rebuild- Forwarded to aisoc:demo to build images from source.+ Build the service images from source instead of using the published+ ones (`docker compose up -d --build`)..PARAMETER CloneDirWhere to clone the repo when running as a one-liner. Default:@@ -72,13 +99,14 @@.\install.ps1 -CloneDir D:\code\aisoc -NoLaunch.NOTES- Exit codes:- 0 success — demo stack is up and your browser opened+ Exit codes (the same set install.sh uses, for the same conditions):+ 0 success — the stack is up and a real event reached the API1 prerequisite install failed2 Docker Desktop refused to come up / WSL2 not enabled- 3 pnpm aisoc:demo failed (stack didn't boot or seed)+ 3 the stack did not start, or a container never became healthy4 preflight checks failed (machine doesn't meet minimums)- 5 git clone failed (network / branch / disk)+ 5 git clone failed (network / branch / disk), or the pipeline+ check failed — the stack started but no event became an alertTested on:- Windows 11 23H2 (x64 + ARM64)@@ -506,10 +534,15 @@ function Test-DockerDaemon {function Install-Node {$major = Get-CommandMajorVersion -Name 'node'+ # Node 22, the version every workflow tests on and both Node images ship.+ # Accepting 20 here handed a self-hoster a different runtime from the one+ # the project builds and tests against, and Node 20 left security support+ # in April 2026. install.sh requires the same major.+ ## $null on the LHS is the PowerShell idiom — putting $null on the right# unboxes the LHS if it's an array, which Get-CommandMajorVersion can# technically return if Select-Object -First 1 misbehaves.- if (($null -ne $major) -and ($major -ge 20)) {+ if (($null -ne $major) -and ($major -ge 22)) {Write-Ok "node already installed: $((& node --version))"return}@@ -517,7 +550,12 @@ function Install-Node {if (-not (Test-CommandExists node)) {Stop-WithError "node was installed via winget but isn't on PATH. Open a new PowerShell window and re-run this script."}- Write-Ok "node installed: $((& node --version))"+ $major = Get-CommandMajorVersion -Name 'node'+ if (($null -ne $major) -and ($major -lt 22)) {+ Write-Warn "Installed Node version ($((& node --version))) is older than 22; AiSOC may misbehave."+ } else {+ Write-Ok "node installed: $((& node --version))"+ }}# ─── Step 4: pnpm 8+ via corepack ─────────────────────────────────────────@@ -683,9 +721,19 @@ function Install-Workspace {Write-Info "Installing JS workspace deps (pnpm install)..."Push-Location $RepoRoottry {- & pnpm install --prefer-offline --no-frozen-lockfile+ # `--frozen-lockfile`, the same flag CI, the web image and install.sh+ # use. Without it a self-hoster's install is free to resolve a+ # dependency set nobody tested, which is the one thing an installer+ # must not do quietly.+ & pnpm install --prefer-offline --frozen-lockfileif ($LASTEXITCODE -ne 0) {- Stop-WithError "pnpm install failed."+ Stop-WithError @"+pnpm install failed.++If it reported a lockfile mismatch, your checkout's package.json and+pnpm-lock.yaml disagree — re-clone, or run:+ git checkout pnpm-lock.yaml+"@}} finally {Pop-Location@@ -693,52 +741,366 @@ function Install-Workspace {Write-Ok "pnpm dependencies installed."}-function Start-Demo {+# The host ports CORE publishes, as service + container port, in the same+# order and with the same owners scripts/doctor.sh checks under --ports-only.+$script:CorePortSpecs = @(+ @{ Port = 5432; Service = 'postgres'; ContainerPort = 5432 },+ @{ Port = 6379; Service = 'redis'; ContainerPort = 6379 },+ @{ Port = 9092; Service = 'kafka'; ContainerPort = 9092 },+ @{ Port = 8000; Service = 'api'; ContainerPort = 8000 },+ @{ Port = 8081; Service = 'ingest-worker'; ContainerPort = 8080 },+ @{ Port = 3000; Service = 'web'; ContainerPort = 3000 }+)++# The host port this deployment's own container publishes for a service, or+# $null. Asking compose is what distinguishes "someone else has 5432" from+# "our own postgres has 5432" — re-running the installer against a running+# stack must not be reported as a conflict with itself.+function Get-ComposePublishedPort {+ param([Parameter(Mandatory)][string]$Service, [Parameter(Mandatory)][int]$ContainerPort)+ $mapped = & docker compose port $Service $ContainerPort 2>$null | Select-Object -Last 1+ if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($mapped)) { return $null }+ $tail = ("$mapped" -split ':')[-1]+ $parsed = 0+ if ([int]::TryParse($tail.Trim(), [ref]$parsed)) { return $parsed }+ return $null+}++function Test-PortBusy {+ param([Parameter(Mandatory)][int]$Port)+ if (Get-Command Get-NetTCPConnection -ErrorAction SilentlyContinue) {+ # Throws rather than returning empty when nothing is listening.+ try { $null = Get-NetTCPConnection -LocalPort $Port -State Listen -ErrorAction Stop; return $true }+ catch { return $false }+ }+ # Get-NetTCPConnection is absent from PowerShell 7 builds without the+ # Windows compatibility modules. netstat ships with every Windows.+ $hit = & netstat -ano -p TCP 2>$null |+ Select-String -Pattern 'LISTENING' |+ Select-String -Pattern (":{0}\s" -f $Port)+ return [bool]$hit+}++# Names whatever is holding a port. "Something else has it" is only+# actionable if the operator can tell what, so this reports a container name+# when Docker published the port and the listening process otherwise.+function Get-PortHolder {+ param([Parameter(Mandatory)][int]$Port)+ if (Test-CommandExists docker) {+ $name = & docker ps --filter "publish=$Port" --format '{{.Names}}' 2>$null | Select-Object -First 1+ if (-not [string]::IsNullOrWhiteSpace($name)) { return "container $name" }+ }+ if (Get-Command Get-NetTCPConnection -ErrorAction SilentlyContinue) {+ try {+ $conn = Get-NetTCPConnection -LocalPort $Port -State Listen -ErrorAction Stop | Select-Object -First 1+ if ($null -ne $conn) {+ $proc = Get-Process -Id $conn.OwningProcess -ErrorAction SilentlyContinue+ if ($null -ne $proc) { return "$($proc.ProcessName) (pid $($conn.OwningProcess))" }+ return "pid $($conn.OwningProcess)"+ }+ } catch {+ # Fall through to the generic answer below.+ }+ }+ return 'an unidentified process'+}++# Names a port conflict before compose hits it. `docker compose up` reports a+# clash as `Bind for 0.0.0.0:5432 failed: port is already allocated` against+# whichever container lost the race, which names neither the process holding+# the port nor what to do about it — and arrives after half the stack has+# already started.+function Test-CorePortsFree {+ $conflicts = @()+ foreach ($spec in $script:CorePortSpecs) {+ $ours = Get-ComposePublishedPort -Service $spec.Service -ContainerPort $spec.ContainerPort+ if (($null -ne $ours) -and ($ours -eq $spec.Port)) {+ Write-Ok "port $($spec.Port) in use by aisoc $($spec.Service)"+ } elseif ($null -ne $ours) {+ # Already remapped. The canonical port being busy is then+ # irrelevant, and failing on it would send the operator off to+ # fix something that is working.+ Write-Ok "aisoc $($spec.Service) is published on $ours (not the default $($spec.Port))"+ } elseif (Test-PortBusy -Port $spec.Port) {+ $conflicts += "port $($spec.Port) is held by $(Get-PortHolder -Port $spec.Port) — aisoc $($spec.Service) needs it"+ } else {+ Write-Log "port $($spec.Port) free"+ }+ }+ if ($conflicts.Count -eq 0) { return }+ Write-Host ''+ foreach ($conflict in $conflicts) { Write-Err $conflict }+ Write-Host ''+ Write-Err 'Not starting: the ports above are taken by something else.'+ Write-Err 'Stop that process, or edit the host port in docker-compose.yml.'+ Write-Err "(A docker-compose.override.yml needs 'ports: !override' — a plain"+ Write-Err ' override appends, leaving the conflicting binding in place.)'+ exit 3+}++# Waits on the services that declare a healthcheck, and refuses to call a+# stack up while any container is dead.+#+# Reading `ps` without `-a` cannot see an *exited* container at all, and a+# *restarting* one reports no health, so both are invisible to the obvious+# loop and the stack gets declared up with services crash-looping behind it.+# A container that is not running is the one thing a wait loop must never+# score as success.+function Wait-StackHealthy {+ Write-Host ''+ Write-Info 'Waiting for services to become healthy...'+ $pending = @()+ for ($attempt = 0; $attempt -lt 60; $attempt++) {+ $lines = @(& docker compose ps -a --format '{{.Service}} {{.State}} {{.Health}}' 2>$null)+ $broken = @()+ $pending = @()+ foreach ($line in $lines) {+ if ([string]::IsNullOrWhiteSpace($line)) { continue }+ $parts = @("$line".Trim() -split '\s+')+ if ($parts.Count -lt 2) { continue }+ $state = $parts[1]+ $health = if ($parts.Count -ge 3) { $parts[2] } else { '' }+ if (($state -in @('exited', 'dead', 'restarting')) -or ($health -eq 'unhealthy')) {+ $broken += $parts[0]+ } elseif ($health -eq 'starting') {+ $pending += $parts[0]+ }+ }+ if ($broken.Count -gt 0) {+ Write-Host ''+ Write-Err "These services are not running: $($broken -join ' ')"+ foreach ($service in $broken) { Write-Err " docker compose logs $service" }+ exit 3+ }+ # An empty listing is not health — compose reported success but there+ # is nothing to be healthy, so keep waiting rather than pass.+ if (($lines.Count -gt 0) -and ($pending.Count -eq 0)) {+ Write-Ok 'Every service reports healthy.'+ return+ }+ Start-Sleep -Seconds 3+ }+ Write-Host ''+ if ($pending.Count -gt 0) {+ Write-Err "Still not healthy after 3 minutes: $($pending -join ' ')"+ } else {+ Write-Err 'No containers are running 3 minutes after compose reported success.'+ }+ Write-Err 'Inspect them with: docker compose ps -a'+ exit 3+}++function Start-Stack {if ($NoLaunch) {- Write-Info "-NoLaunch: skipping pnpm aisoc:demo. To start the stack later:"- Write-Info " cd $RepoRoot; pnpm aisoc:demo"+ Write-Info '-NoLaunch: not starting the stack. To start it later:'+ Write-Info " cd $RepoRoot"+ Write-Info ' docker compose up -d'+ Write-Info ' docker compose run --rm -T api python -m app.scripts.bootstrap_admin'+ Write-Info ' python tests\e2e\golden_pipeline\run_golden_pipeline.py'+ Write-Info 'Or simply re-run this installer without -NoLaunch.'return}- Write-Section 'Launching AiSOC demo stack'- Write-Info "Handing off to 'pnpm aisoc:demo' — this will pull images, start the"- Write-Info "stack, seed the showcase ransomware case, and open your browser."+ Write-Section 'Starting AiSOC (CORE profile)'+ Write-Info 'Starting the CORE stack: postgres, redis, kafka, the LLM gateway,'+ Write-Info 'ingest, fusion, api, agents, realtime and the web console.'+ Write-Info ''+ Write-Info "This is the same stack 'make up' starts on Linux and macOS and the"+ Write-Info 'same one CI tests. It runs the real pipeline: an event you send is'+ Write-Info 'normalized, placed on the event spine, evaluated against the'+ Write-Info 'detection corpus, correlated and written as an alert.'Write-Host ''- $demoArgs = @()- if ($NoPull) { $demoArgs += '--no-pull' }- if ($Rebuild) { $demoArgs += '--rebuild' }-Push-Location $RepoRoottry {- if ($demoArgs.Count -gt 0) {- & pnpm aisoc:demo @demoArgs- } else {- & pnpm aisoc:demo+ Test-CorePortsFree++ $composeArgs = @('compose', 'up', '-d')+ if ($Rebuild) { $composeArgs += '--build' }+ & docker @composeArgs+ if ($LASTEXITCODE -ne 0) {+ Stop-WithError "'docker compose up -d' exited non-zero. Run 'docker compose ps -a' to see which service failed." 3}+ Wait-StackHealthy+ } finally {+ Pop-Location+ }+}++# ─── Step 8: the first administrator ──────────────────────────────────────+#+# Creates the first administrator and prints its password once. Idempotent:+# a second run reports the existing account and changes nothing, which is why+# this runs unconditionally after every start.+#+# Failure here is reported but does not fail the install. The stack is+# genuinely running at this point, and aborting over an account the operator+# can create with one more command would be the wrong signal — but it must+# say so, because silence would leave them at a login form with no credential+# and no explanation.+function New-AdminAccount {+ if ($NoLaunch) { return }+ Write-Section 'Creating the first administrator'+ Push-Location $RepoRoot+ try {+ # Output is deliberately neither captured nor suppressed: the+ # generated password is printed here, once, and stored nowhere.+ & docker compose run --rm -T api python -m app.scripts.bootstrap_adminif ($LASTEXITCODE -ne 0) {- Stop-WithError "pnpm aisoc:demo exited non-zero." 3+ Write-Host ''+ Write-Warn 'Could not create the administrator — the stack is up, but you cannot sign in yet.'+ Write-Warn 'Find out why, then try again:'+ Write-Warn ' docker compose logs api'+ Write-Warn ' docker compose run --rm -T api python -m app.scripts.bootstrap_admin'}} finally {Pop-Location}}+# ─── Step 9: post-install verification ────────────────────────────────────+#+# "The containers started" is not "the application works", and this installer+# used to print a success banner purely because the handoff exited 0. A user+# whose pipeline was broken was told everything was fine.+#+# The golden pipeline posts one real event and follows it through Kafka,+# fusion, detection and Postgres, then reads the alert back from the API. If+# that fails, the install has failed, whatever the containers say.++# Only set once an event has actually come back out of the API. The closing+# banner reads this rather than assuming, because the check can legitimately+# be skipped (no interpreter) and a banner that claims it ran anyway is the+# defect the check exists to catch.+$script:PipelineVerified = $false++# Windows spells python at least three ways and ships a Microsoft Store stub+# called `python.exe` that is not an interpreter, so the version output is+# checked rather than the name.+function Resolve-Python {+ $candidates = @(+ @{ Exe = 'python3'; Prefix = @() },+ @{ Exe = 'python'; Prefix = @() },+ @{ Exe = 'py'; Prefix = @('-3') }+ )+ foreach ($candidate in $candidates) {+ if (-not (Test-CommandExists $candidate.Exe)) { continue }+ try {+ $probeArgs = @($candidate.Prefix) + @('--version')+ # Deliberately not `| Select-Object -First 1`: that stops the+ # pipeline before the native command finishes, so $LASTEXITCODE is+ # never assigned — and under Set-StrictMode *reading* an unassigned+ # $LASTEXITCODE throws, which the catch below would swallow into+ # "no interpreter" for every candidate. The installer would then+ # skip the pipeline check on every machine, silently.+ $out = (& $candidate.Exe @probeArgs 2>&1 | Out-String)+ $code = if (Test-Path Variable:LASTEXITCODE) { $LASTEXITCODE } else { 0 }+ # The version string is the real test. Windows ships a Microsoft+ # Store stub named python.exe that prints a "not found" notice+ # instead of a version, and it is on PATH by default.+ if (($code -eq 0) -and ($out -match 'Python\s+3\.')) { return $candidate }+ } catch {+ # Not a usable interpreter; try the next spelling.+ }+ }+ return $null+}++function Invoke-SmokeTest {+ if ($NoLaunch) { return }+ Write-Section 'Verifying the pipeline end to end'++ $runner = Join-Path $RepoRoot 'tests\e2e\golden_pipeline\run_golden_pipeline.py'+ if (-not (Test-Path $runner)) {+ Write-Warn "Golden pipeline runner not found at $runner — skipping verification."+ return+ }++ $python = Resolve-Python+ if ($null -eq $python) {+ Write-Warn 'No Python 3 interpreter on PATH — skipping pipeline verification.'+ Write-Warn 'Install one, then verify manually:'+ Write-Warn ' winget install --id Python.Python.3.12'+ Write-Warn ' python tests\e2e\golden_pipeline\run_golden_pipeline.py'+ return+ }++ $rc = 1+ Push-Location $RepoRoot+ try {+ $runnerArgs = @($python.Prefix) + @($runner)+ & $python.Exe @runnerArgs+ $rc = $LASTEXITCODE+ } finally {+ Pop-Location+ }++ if ($rc -eq 0) {+ $script:PipelineVerified = $true+ Write-Ok 'Pipeline verified: a real event became a retrievable alert.'+ return+ }++ Write-Host ''+ Write-Err 'The stack started, but a real event did not become an alert.'+ Write-Err 'This is a genuine failure, not a warning: AiSOC is not working yet.'+ Write-Err ''+ Write-Err 'Diagnose it with:'+ Write-Err ' docker compose ps -a'+ Write-Err ' docker compose logs fusion'+ Write-Err ''+ Write-Err 'Then re-run the check:'+ Write-Err " $($python.Exe) tests\e2e\golden_pipeline\run_golden_pipeline.py"+ exit 5+}+# ─── Final banner ─────────────────────────────────────────────────────────function Write-SuccessBanner {+ if ($NoLaunch) {+ Write-Host ''+ Write-Host 'Prerequisites installed and the repository is ready.' -ForegroundColor Green+ Write-Host 'The stack was not started (-NoLaunch).' -ForegroundColor DarkGray+ Write-Host ''+ return+ }++ $adminEmail = if ([string]::IsNullOrWhiteSpace($env:AISOC_ADMIN_EMAIL)) { '[email protected]' } else { $env:AISOC_ADMIN_EMAIL }+Write-Host ''- Write-Host 'AiSOC is up and running.' -ForegroundColor Green+ if ($script:PipelineVerified) {+ Write-Host 'AiSOC is up and running, and a real event reached the API.' -ForegroundColor Green+ } else {+ # The pipeline check was skipped, so the stack being healthy is all+ # that is actually known. Saying more would be the exact failure this+ # verification step exists to prevent.+ Write-Host 'AiSOC is up and every service reports healthy.' -ForegroundColor Green+ Write-Host 'The end-to-end pipeline check did not run — see the note above.' -ForegroundColor Yellow+ }Write-Host ''Write-Host ' Web console: http://localhost:3000'- Write-Host ' Showcase case: http://localhost:3000/cases/INC-RT-001?tab=ledger'Write-Host ' API + Swagger: http://localhost:8000/api/docs'Write-Host ' Realtime WS: ws://localhost:8086'Write-Host ''+ Write-Host " Sign in as: $adminEmail"+ Write-Host ' The password was printed above, once, when the administrator was'+ Write-Host ' created. It is not stored anywhere. Lost it? Mint a new one with the'+ Write-Host ' reset command below.'+ Write-Host ''Write-Host "Useful commands (run from $RepoRoot):" -ForegroundColor DarkGray- Write-Host ' pnpm aisoc:doctor # health-check the stack'- Write-Host ' pnpm aisoc:demo:logs # tail logs'- Write-Host ' pnpm aisoc:demo:down # stop everything and wipe demo data'- Write-Host ' .\scripts\install\uninstall.ps1 # full uninstall'+ Write-Host ' docker compose ps # every service and its health'+ Write-Host ' docker compose logs -f --tail=200 # follow logs (add a service name to narrow)'+ Write-Host ' python tests\e2e\golden_pipeline\run_golden_pipeline.py'+ Write-Host ' # re-run the end-to-end pipeline check'+ Write-Host ' docker compose run --rm -T api python -m app.scripts.bootstrap_admin --reset-password'+ Write-Host ' # mint a new administrator password'+ Write-Host ' docker compose run --rm -e AISOC_ALLOW_SEED=1 api python -m app.scripts.seed_demo'+ Write-Host ' # load clearly-labelled synthetic data'+ Write-Host ' docker compose down # stop the stack, keep your data'+ Write-Host ' docker compose down -v # stop the stack and delete all volumes'+ Write-Host ' .\uninstall.ps1 # full uninstall (containers + images + repo)'+ Write-Host ''+ Write-Host 'The demo dataset is synthetic. Every row is marked is_synthetic=true' -ForegroundColor DarkGray+ Write-Host 'and labelled in the console. See "Real vs synthetic data" in README.md.' -ForegroundColor DarkGrayWrite-Host ''}@@ -790,6 +1152,16 @@ function Invoke-Main {Write-Section 'AiSOC One-Click Installer (Windows)'+ if ($NoPull) {+ # Kept as a parameter so an existing invocation does not become a+ # parameter-binding error, but it no longer means anything: the+ # installer starts the stack with `docker compose up -d`, which pulls+ # only the images it does not already have. Saying so is better than+ # accepting the flag and silently ignoring it.+ Write-Warn '-NoPull no longer applies: the stack starts with `docker compose up -d`,'+ Write-Warn 'which pulls only images that are missing. The flag is ignored.'+ }+Test-WindowsVersion# Preflight before we touch anything. In Diagnose mode this is also@@ -827,7 +1199,9 @@ function Invoke-Main {Resolve-RepoInitialize-EnvFileInstall-Workspace- Start-Demo+ Start-Stack+ New-AdminAccount+ Invoke-SmokeTestWrite-SuccessBanner}diff --git a/tests/test_docs_profile_table_gate.py b/tests/test_docs_profile_table_gate.pynew file mode 100644index 000000000..1e2b66cbe--- /dev/null+++ b/tests/test_docs_profile_table_gate.py@@ -0,0 +1,135 @@+"""The published profile table must be what `docker-compose.yml` actually says.++The quick start tells a reader which services each compose profile starts.+That table had drifted: it put `kafka-ui` on 8080 (it is 8090) and+`connectors` on 8003 (that is `fusion`; connectors is 8088), it filed+`actions` under `full` alone when it is in `full` and `chatops`, and it+omitted the `monitoring` and `chatops` profiles entirely. None of that is+visible to a reader, and all of it sends someone to the wrong port.++A prose table cannot be kept in step with a 1,100-line compose file by+attention, and this one is moving: services get promoted into the default+profile when the default install turns out not to be able to do something+(the LLM gateway was a `full` service until 2026-09, which meant the default+install could not do AI triage even with a provider key set). So the check is+mechanical, and it runs in the direction drift actually happens — from the+compose file to the documentation.++If this fails because you moved a service between profiles, the fix is to+update the table in `apps/docs/docs/quickstart.md`. The failure message names+the rows.+"""++from __future__ import annotations++import re+from pathlib import Path++import pytest+import yaml++REPO = Path(__file__).resolve().parents[1]+COMPOSE = REPO / "docker-compose.yml"+QUICKSTART = REPO / "apps/docs/docs/quickstart.md"++#: The table's row label for services that declare no `profiles:` key.+DEFAULT_LABEL = "default"+++def _compose_profiles() -> dict[str, set[str]]:+ """profile name -> the services compose starts under it."""+ services = yaml.safe_load(COMPOSE.read_text(encoding="utf-8"))["services"]+ out: dict[str, set[str]] = {}+ for name, cfg in services.items():+ for profile in (cfg or {}).get("profiles") or [DEFAULT_LABEL]:+ out.setdefault(profile, set()).add(name)+ return out+++def _table_rows() -> list[list[str]]:+ """The `| Profile | Services |` table's data rows, as stripped cells."""+ text = QUICKSTART.read_text(encoding="utf-8")+ header = re.search(r"^\|\s*Profile\s*\|\s*Services\s*\|\s*$", text, re.MULTILINE)+ assert header, "quickstart.md no longer has a `| Profile | Services |` table"++ rows: list[list[str]] = []+ for line in text[header.end() :].lstrip("\n").splitlines():+ if not line.startswith("|"):+ break+ cells = [c.strip() for c in line.strip().strip("|").split("|")]+ if len(cells) < 2 or set(cells[0]) <= set("-: "):+ continue # the |---|---| separator+ rows.append(cells)+ assert rows, "the `| Profile | Services |` table has no rows"+ return rows+++def _documented_profiles() -> dict[str, set[str]]:+ """profile name -> the services the quick-start table lists under it.++ Service names are the **bolded** entries in the Services column, which is+ the convention the table already used. A profile's own name is whatever+ the row's first cell contains, stripped of backticks and the+ `*(default — CORE)*` decoration.+ """+ out: dict[str, set[str]] = {}+ for cells in _table_rows():+ label = cells[0].strip("*`_ ()")+ if label.lower().startswith(DEFAULT_LABEL):+ label = DEFAULT_LABEL+ out[label] = set(re.findall(r"\*\*([a-z0-9][a-z0-9._-]*)\*\*", cells[1]))+ return out+++def test_every_compose_profile_is_documented() -> None:+ compose = _compose_profiles()+ documented = _documented_profiles()+ missing = sorted(set(compose) - set(documented))+ assert not missing, (+ f"docker-compose.yml defines profiles the quick-start table never mentions: {missing}. "+ f"Add a row for each in {QUICKSTART.relative_to(REPO)}."+ )+++def test_no_documented_profile_is_invented() -> None:+ compose = _compose_profiles()+ documented = _documented_profiles()+ invented = sorted(set(documented) - set(compose))+ assert not invented, f"the quick-start table lists profiles docker-compose.yml does not define: {invented}"++[email protected]("profile", sorted(_compose_profiles()))+def test_profile_membership_matches_compose(profile: str) -> None:+ actual = _compose_profiles()[profile]+ documented = _documented_profiles().get(profile, set())+ undocumented = sorted(actual - documented)+ phantom = sorted(documented - actual)+ assert not undocumented and not phantom, (+ f"profile {profile!r} has drifted from the quick-start table.\n"+ f" started by compose but not documented: {undocumented or 'none'}\n"+ f" documented but not started by compose: {phantom or 'none'}\n"+ f"Update the {profile!r} row in {QUICKSTART.relative_to(REPO)}."+ )+++def test_documented_host_ports_match_compose() -> None:+ """A port in the table is a reader's next command; a wrong one is a dead end."""+ services = yaml.safe_load(COMPOSE.read_text(encoding="utf-8"))["services"]+ actual: dict[str, set[str]] = {}+ for name, cfg in services.items():+ published = set()+ for mapping in (cfg or {}).get("ports") or []:+ match = re.match(r"^(?:[\d.]+:)?(\d+):", str(mapping))+ if match:+ published.add(match.group(1))+ actual[name] = published++ wrong: list[str] = []+ # `**web** (3000)` / `**clickhouse** (8123/9000)` / `**web** (3000, Next)`+ entry = re.compile(r"\*\*([a-z0-9][a-z0-9._-]*)\*\*\s*\(([\d/]+)(?:,[^)]*)?\)")+ for cells in _table_rows():+ for name, ports in entry.findall(cells[1]):+ claimed = set(ports.split("/"))+ if name in actual and claimed - actual[name]:+ wrong.append(f"{name}: table says {sorted(claimed)}, compose publishes {sorted(actual[name]) or 'no host port'}")+ assert not wrong, "quick-start table publishes host ports the compose file does not:\n " + "\n ".join(wrong)diff --git a/tests/test_installer_parity_gate.py b/tests/test_installer_parity_gate.pynew file mode 100644index 000000000..1fe28421c--- /dev/null+++ b/tests/test_installer_parity_gate.py@@ -0,0 +1,190 @@+"""The two installers must start the same product and prove it the same way.++`install.sh` was changed to bring up the real stack with `make up`, create an+administrator and run the golden pipeline. `install.ps1` was not, and nothing+noticed for a release: it kept handing off to `pnpm aisoc:demo`, a compose+file with no ingest service, no fusion service and Kafka disabled, whose only+content came from a seed script writing rows straight into Postgres — and+then printed "AiSOC is up and running." A Windows evaluator saw a populated+console and concluded the platform worked, having never run the platform.++Nothing could catch that, because the two installers share no code and the+Windows one exercised no path CI ran. The checks below are file-content+assertions for exactly that reason: the defect lived in the gap between two+files that are supposed to agree and have no mechanism forcing them to.++Windows has no `make`, so install.ps1 cannot call the Makefile and the+comparison cannot be "does it run the same command line". What it can be, and+is, is "does it run the same *underlying* commands" — the ones the Makefile's+`up`, `bootstrap` and `smoke` targets run — plus the narrower class of bug+that shipped alongside: a script telling the user to run a file that is not+in the repository.+"""++from __future__ import annotations++import re+from pathlib import Path++import pytest++REPO = Path(__file__).resolve().parents[1]++INSTALL_PS1 = REPO / "install.ps1"+INSTALL_SH = REPO / "install.sh"+UNINSTALL_PS1 = REPO / "uninstall.ps1"+MAKEFILE = REPO / "Makefile"++# The stack a user is entitled to get from either installer. Anything else is+# a preview of the interface rather than a deployment of the product.+DEMO_HANDOFF = "pnpm aisoc:demo"+++def _read(path: Path) -> str:+ assert path.is_file(), f"{path.relative_to(REPO)} is missing"+ return path.read_text(encoding="utf-8")+++def _code_lines(text: str) -> list[str]:+ """Lines that are not PowerShell comments.++ Every assertion here is about what the script *does*. The comment blocks+ deliberately name the wrong thing in order to explain why it is wrong, so+ scanning raw text would fail the file for documenting its own history.+ """+ out = []+ in_block_comment = False+ for line in text.splitlines():+ stripped = line.strip()+ if stripped.startswith("<#"):+ in_block_comment = True+ if in_block_comment:+ if "#>" in stripped:+ in_block_comment = False+ continue+ if stripped.startswith("#"):+ continue+ out.append(line)+ return out+++# ── What the installer starts ───────────────────────────────────────────────+++def test_windows_installer_does_not_hand_off_to_the_demo_stack() -> None:+ """install.ps1 must not execute `pnpm aisoc:demo`.++ It may still *name* it in a comment explaining why it does not, which is+ why this reads code lines only.+ """+ offenders = [line for line in _code_lines(_read(INSTALL_PS1)) if DEMO_HANDOFF in line]+ assert not offenders, (+ "install.ps1 executes the demo stack:\n "+ + "\n ".join(o.strip() for o in offenders)+ + "\nThat compose file has no ingest and no fusion service; it cannot "+ "answer whether AiSOC works."+ )+++def test_windows_installer_starts_the_real_stack() -> None:+ code = "\n".join(_code_lines(_read(INSTALL_PS1)))+ assert "'compose', 'up', '-d'" in code or "docker compose up -d" in code, (+ "install.ps1 must start the deployment defined by the root docker-compose.yml, the same one `make up` starts."+ )+++def test_windows_installer_waits_for_containers_to_be_healthy() -> None:+ """`docker compose up -d` returning 0 is not the stack being up."""+ code = "\n".join(_code_lines(_read(INSTALL_PS1)))+ assert "docker compose ps -a" in code, (+ "install.ps1 must poll `docker compose ps -a` before declaring the "+ "stack up. Without `-a` an exited container is absent from the "+ "listing entirely and a crash-looping service reads as success."+ )+ for state in ("exited", "restarting", "unhealthy"):+ assert state in code, f"install.ps1's wait loop does not treat {state!r} as a failure"+++# ── Parity with the Makefile targets install.sh reaches through `make` ──────+++def _makefile_recipe(target: str) -> str:+ text = _read(MAKEFILE)+ match = re.search(rf"^{re.escape(target)}:.*?\n((?:\t.*\n|\n)*)", text, re.MULTILINE)+ assert match, f"Makefile has no `{target}` target"+ return match.group(1)+++def test_windows_installer_creates_the_first_administrator() -> None:+ """The Windows installer must run the module `make bootstrap` runs.++ Without it no administrator exists, and a Windows user either cannot sign+ in at all or signs in to a seeded database and evaluates that as the+ product.+ """+ module = "app.scripts.bootstrap_admin"+ assert module in _makefile_recipe("bootstrap"), f"`make bootstrap` no longer runs {module}; update this gate and install.ps1 together"+ code = "\n".join(_code_lines(_read(INSTALL_PS1)))+ assert module in code, f"install.ps1 never runs {module}, so no administrator is created"+ assert "docker compose run --rm -T api" in code, (+ "install.ps1 must create the administrator the same way `make bootstrap` does — a one-shot `docker compose run --rm -T api`"+ )+++def test_windows_installer_runs_the_golden_pipeline() -> None:+ """ "The containers started" is not "the application works"."""+ runner = "tests/e2e/golden_pipeline/run_golden_pipeline.py"+ assert runner in _makefile_recipe("smoke"), f"`make smoke` no longer runs {runner}; update this gate and install.ps1 together"+ code = "\n".join(_code_lines(_read(INSTALL_PS1)))+ windows_runner = runner.replace("/", "\\")+ assert (runner in code) or (windows_runner in code), (+ "install.ps1 never runs the golden pipeline, so it cannot tell a working "+ "deployment from a broken one before printing a success banner."+ )+++def test_both_installers_use_a_frozen_lockfile() -> None:+ """A self-hoster must not silently resolve a dependency set nobody tested."""+ for path in (INSTALL_SH, INSTALL_PS1):+ text = _read(path)+ assert "--frozen-lockfile" in text, f"{path.name} does not pass --frozen-lockfile to pnpm install"+ assert "--no-frozen-lockfile" not in text, f"{path.name} still passes --no-frozen-lockfile"+++def test_both_installers_require_the_same_node_major() -> None:+ """A different runtime from the one the project builds and tests against+ is a difference no user asked for and none can see."""+ sh_majors = {int(m) for m in re.findall(r"version_at_least node (\d+)", _read(INSTALL_SH))}+ assert len(sh_majors) == 1, f"install.sh checks inconsistent Node majors: {sorted(sh_majors)}"++ ps1 = _read(INSTALL_PS1)+ install_node = re.search(r"function Install-Node \{(.*?)\n\}", ps1, re.DOTALL)+ assert install_node, "install.ps1 has no Install-Node function"+ ps1_majors = {int(m) for m in re.findall(r"\$major -ge (\d+)", install_node.group(1))}+ assert ps1_majors == sh_majors, f"install.sh requires Node {sorted(sh_majors)} and install.ps1 requires {sorted(ps1_majors)}"+++# ── Paths the scripts tell a user to run ────────────────────────────────────++# `.\scripts\install\uninstall.ps1` was printed by the closing banner for a+# release. The file is `uninstall.ps1`, at the repository root, and has never+# been anywhere else — so the last thing the installer told a Windows user to+# do could not work.+_PS1_PATH = re.compile(r"\.\\([A-Za-z0-9_\\\-./]+\.ps1)")++[email protected]("script", [INSTALL_PS1, UNINSTALL_PS1], ids=lambda p: p.name)+def test_referenced_powershell_paths_exist(script: Path) -> None:+ text = _read(script)+ missing = sorted({candidate for candidate in _PS1_PATH.findall(text) if not (REPO / candidate.replace("\\", "/")).is_file()})+ assert not missing, f"{script.name} tells the user to run files that are not in the repository: {missing}"+++def test_windows_uninstaller_tears_down_the_stack_the_installer_starts() -> None:+ """Tearing down only the demo project left every CORE container running,+ Postgres still holding 5432, under a banner saying the uninstall was+ complete."""+ code = "\n".join(_code_lines(_read(UNINSTALL_PS1)))+ assert "'docker-compose.yml'" in code or '"docker-compose.yml"' in code, (+ "uninstall.ps1 never brings down the root docker-compose.yml project, which is the one install.ps1 starts."+ )diff --git a/uninstall.ps1 b/uninstall.ps1index 20a6b5a48..57b98992a 100644--- a/uninstall.ps1+++ b/uninstall.ps1@@ -3,11 +3,11 @@AiSOC — Uninstaller for Windows..DESCRIPTION- Tears down whatever install.ps1 + `pnpm aisoc:demo` brought up, in- decreasing levels of aggressiveness:+ Tears down whatever install.ps1 brought up, in decreasing levels of+ aggressiveness:- default Stop the demo stack and delete its named volumes.- (Equivalent to: pnpm aisoc:demo:down)+ default Stop the stack and delete its named volumes.+ (Equivalent to: docker compose down -v)-RemoveImages Also remove ghcr.io/beenuar/aisoc-* images(saves ~2-3 GB of disk).-RemoveNodeModules@@ -23,7 +23,7 @@winget uninstall --id OpenJS.NodeJS.LTSwinget uninstall --id Docker.DockerDesktop- Touch any other Docker containers, images, or volumes outside the- aisoc-demo project. We're surgical here.+ AiSOC compose projects. We're surgical here..PARAMETER RemoveImagesAlso remove the ghcr.io/beenuar/aisoc-* container images.@@ -103,10 +103,10 @@ function Confirm-Action {}# ─── Locate the AiSOC repo ──────────────────────────────────────────────────-# We need the path to infra/compose/docker-compose.demo.yml so `docker compose down -v` can-# resolve project resources cleanly. Prefer the directory two levels above-# this script (script lives in <repo>/scripts/install/), then fall back to-# the canonical $env:USERPROFILE\aisoc.+# We need the repo root so `docker compose down -v` can resolve project+# resources cleanly. Prefer the directory this script lives in (the repo+# root, alongside install.ps1), then fall back to the canonical+# $env:USERPROFILE\aisoc, then the current directory.function Find-RepoRoot {# The uninstaller lives at the repo root, alongside install.ps1.@@ -146,7 +146,7 @@ if (-not $RepoRoot) {}}-# ─── Step 1: stop the demo stack ────────────────────────────────────────────+# ─── Step 1: stop the stack ─────────────────────────────────────────────────function Test-DockerReachable {# PowerShell native commands don't throw on non-zero exit, so try/catch@@ -157,7 +157,7 @@ function Test-DockerReachable {return ($LASTEXITCODE -eq 0)}-function Stop-DemoStack {+function Stop-AiSOCStack {if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {Write-Warn "docker not on PATH; skipping compose down."return@@ -168,14 +168,45 @@ function Stop-DemoStack {}if (-not $RepoRoot) { return }- Write-Info "Stopping AiSOC demo stack and removing its volumes..."+ # Two compose projects, because two things can have been started.+ #+ # install.ps1 brings up the deployment defined by the root+ # docker-compose.yml. Tearing down only infra/compose/docker-compose.demo.yml —+ # which is what this did while install.ps1 still handed off to+ # `pnpm aisoc:demo` — left every CORE container running, Postgres still+ # holding 5432, under a banner that said the uninstall was complete.+ #+ # The demo file is still torn down afterwards so that anyone who ran the+ # older installer, or `pnpm aisoc:demo` directly, is cleaned up too. A+ # project that was never started exits non-zero here, which is not a+ # failure and is reported as a note rather than a warning.+ $projects = @(+ @{ Label = 'AiSOC stack'; File = 'docker-compose.yml'; Required = $true },+ @{ Label = 'AiSOC demo stack'; File = 'infra/compose/docker-compose.demo.yml'; Required = $false }+ )+Push-Location $RepoRoottry {- docker compose -f infra/compose/docker-compose.demo.yml down -v --remove-orphans- if ($LASTEXITCODE -ne 0) {- Write-Warn "compose down exited with code $LASTEXITCODE; some resources may not have been cleaned up."- } else {- Write-Ok "Demo stack stopped, named volumes deleted."+ foreach ($project in $projects) {+ if (-not (Test-Path (Join-Path $RepoRoot $project.File))) { continue }+ Write-Info "Stopping $($project.Label) and removing its volumes..."+ # Every optional profile is named so containers started by+ # `--profile full` (and friends) come down too; compose only acts+ # on profiles it was told about, so omitting them leaves the lake,+ # graph and monitoring containers behind.+ docker compose -f $project.File `+ --profile full --profile monitoring --profile chatops `+ --profile extras --profile osquery `+ down -v --remove-orphans+ if ($LASTEXITCODE -ne 0) {+ if ($project.Required) {+ Write-Warn "compose down exited with code $LASTEXITCODE; some resources may not have been cleaned up."+ } else {+ Write-Info " (nothing to remove for $($project.Label))"+ }+ } else {+ Write-Ok "$($project.Label) stopped, named volumes deleted."+ }}} finally {Pop-Location@@ -322,7 +353,7 @@ function Remove-RepoClone {# ─── Main ───────────────────────────────────────────────────────────────────Write-Section "AiSOC Uninstaller"-Stop-DemoStack+Stop-AiSOCStackRemove-AiSOCImagesRemove-NodeModulesTreesRemove-RepoClone