Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/ai-memory-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: ai-memory install one-liners

# Nightly check of what a user actually types. The published URLs are fetched and
# compared with this repository, then the launchers run: without a terminal they
# must print the command to run, and the command they print must be reachable.
# The installers themselves are tested in memgraph/ai-toolkit.
on:
schedule:
- cron: "17 4 * * *"
pull_request:
paths:
- "code-examples/ai-memory.*"
- ".github/workflows/ai-memory-install.yaml"
workflow_dispatch: {}

jobs:
urls:
# Compares the published copies with this repo, so a PR that changes a launcher always differs from
# what is published until it merges; it only means something on the nightly and manual runs.
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Published launchers match this repository
run: |
set -euo pipefail
curl -fsSL https://install.memgraph.com/ai-memory -o published.sh
curl -fsSL https://install.memgraph.com/ai-memory/windows -o published.ps1
diff published.sh code-examples/ai-memory.sh
diff published.ps1 code-examples/ai-memory.ps1

- name: The installers the launchers point at exist
run: |
set -euo pipefail
for script in install.sh install.ps1; do
curl -fsSL -o /dev/null "https://raw.githubusercontent.com/memgraph/ai-toolkit/main/context-graph/scripts/$script"
done

launcher:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4

- name: Without a terminal, the launcher prints the command and installs nothing
shell: bash
run: |
if [ "$RUNNER_OS" = Windows ]; then
out=$(powershell -NoProfile -File code-examples/ai-memory.ps1 < /dev/null 2>&1)
want='install.ps1'
else
out=$(bash code-examples/ai-memory.sh < /dev/null 2>&1)
want='install.sh'
fi
echo "$out"
grep -q "$want" <<<"$out"
! command -v memgraph-context-graph
10 changes: 7 additions & 3 deletions code-examples/ai-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ macOS / Linux:
curl -sSL https://install.memgraph.com/ai-memory | bash
```

Windows runs Context Graph's setup from WSL or Git Bash; from PowerShell,
`iwr https://install.memgraph.com/ai-memory/windows -useb | iex` prints the
command to run there.
Windows (PowerShell 5.1 or 7+):

```powershell
iwr https://install.memgraph.com/ai-memory/windows -useb | iex
```

The setup needs a terminal to ask its questions on. Without one (CI, output sent
to a file), or with `AI_MEMORY_SKIP_SETUP=1`, the script only prints the command:
Expand All @@ -45,6 +47,8 @@ to a file), or with `AI_MEMORY_SKIP_SETUP=1`, the script only prints the command
curl -fsSL https://raw.githubusercontent.com/memgraph/ai-toolkit/main/context-graph/scripts/install.sh | bash
```

or, on Windows, `iwr https://raw.githubusercontent.com/memgraph/ai-toolkit/main/context-graph/scripts/install.ps1 -useb | iex`.

## After Setup

- `memgraph-context-graph ui` shows what your agents capture, in the terminal.
Expand Down
24 changes: 14 additions & 10 deletions code-examples/ai-memory.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
# The Windows counterpart of ai-memory.sh. Context Graph's setup
# (github.com/memgraph/ai-toolkit/tree/main/context-graph) does the work: it finds
# or starts Memgraph and connects your coding agents, so what they know, did and
# know how to do is kept as one graph. It is a shell script, so on Windows it runs
# from WSL or Git Bash; this script says so and prints the command, as it cannot
# ask its questions from here.
# know how to do is kept as one graph. It asks before changing anything.
#
# Needs a console to ask its questions on. Without one (CI, output sent to a file),
# or with AI_MEMORY_SKIP_SETUP=1, the script prints the command to run instead.
#
# Usage (PowerShell 5.1 or PowerShell 7+):
# iwr https://install.memgraph.com/ai-memory/windows -useb | iex
Expand All @@ -18,14 +19,17 @@

Set-StrictMode -Version 2.0

$InstallUrl = 'https://raw.githubusercontent.com/memgraph/ai-toolkit/main/context-graph/scripts/install.sh'
$InstallUrl = 'https://raw.githubusercontent.com/memgraph/ai-toolkit/main/context-graph/scripts/install.ps1'

Write-Host ''
Write-Host 'memgraph' -ForegroundColor DarkYellow
Write-Host ''
Write-Host 'AI memory: what an assistant knows, did, and knows how to do, as one graph.' -ForegroundColor DarkGray
Write-Host 'Context Graph sets it up: it finds or starts Memgraph and connects your coding agents.' -ForegroundColor DarkGray
Write-Host ''
Write-Host 'In WSL or Git Bash, run:'
Write-Host " curl -fsSL $InstallUrl | bash"
Write-Host ''

$HasConsole = -not [Console]::IsInputRedirected -and -not [Console]::IsOutputRedirected
if (-not $env:AI_MEMORY_SKIP_SETUP -and $HasConsole) {
Invoke-Expression (Invoke-WebRequest -UseBasicParsing $InstallUrl).Content
} else {
Write-Host ''
Write-Host 'Set it up with:'
Write-Host " iwr $InstallUrl -useb | iex"
}
Loading