garaje 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cli.js +74 -0
  3. package/dist/driver/compose.js +127 -0
  4. package/dist/driver/index.js +33 -0
  5. package/dist/driver/types.js +7 -0
  6. package/dist/host/attach.js +12 -0
  7. package/dist/host/auth-presets.js +13 -0
  8. package/dist/host/auth-resolvers.js +46 -0
  9. package/dist/host/auth.js +140 -0
  10. package/dist/host/bay.js +61 -0
  11. package/dist/host/compose.js +65 -0
  12. package/dist/host/docker.js +15 -0
  13. package/dist/host/doctor.js +119 -0
  14. package/dist/host/down.js +17 -0
  15. package/dist/host/init.js +131 -0
  16. package/dist/host/logs.js +12 -0
  17. package/dist/host/pi.js +15 -0
  18. package/dist/host/sync.js +7 -0
  19. package/dist/host/up.js +34 -0
  20. package/dist/park/compose.js +190 -0
  21. package/dist/park/dockerfile.js +23 -0
  22. package/dist/park/index.js +77 -0
  23. package/dist/park/ports.js +11 -0
  24. package/dist/park/recipe.js +12 -0
  25. package/dist/sessions/collect.js +86 -0
  26. package/dist/sessions/render.js +24 -0
  27. package/dist/sessions/run.js +14 -0
  28. package/dist/upgrade/classify.js +137 -0
  29. package/dist/upgrade/index.js +94 -0
  30. package/dist/upgrade/pins.js +13 -0
  31. package/package.json +26 -0
  32. package/templates/.agent/README.md +17 -0
  33. package/templates/.agent/commands/.gitkeep +0 -0
  34. package/templates/.agent/rules/.gitkeep +0 -0
  35. package/templates/.agent/skills/.gitkeep +0 -0
  36. package/templates/.env.example +3 -0
  37. package/templates/.garaje-version +1 -0
  38. package/templates/.pi/README.md +17 -0
  39. package/templates/.pi/settings.json +13 -0
  40. package/templates/AGENTS.md +38 -0
  41. package/templates/compose.framework.yaml +60 -0
  42. package/templates/docker-compose.yml +13 -0
  43. package/templates/garaje.yaml +14 -0
  44. package/templates/gitignore +26 -0
  45. package/templates/pi/Dockerfile +56 -0
  46. package/templates/pi/PI_VERSION +1 -0
  47. package/templates/pi/entrypoint.sh +49 -0
@@ -0,0 +1,56 @@
1
+ FROM node:22-bookworm
2
+
3
+ # Core CLI tools the agent leans on. ripgrep + fd give fast search;
4
+ # gh + jq + curl cover most HTTP / GitHub flows; tini gives clean PID 1.
5
+ RUN apt-get update && apt-get install -y --no-install-recommends \
6
+ git \
7
+ ripgrep \
8
+ fd-find \
9
+ jq \
10
+ curl \
11
+ ca-certificates \
12
+ tini \
13
+ && ln -s "$(command -v fdfind)" /usr/local/bin/fd \
14
+ && curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
15
+ | tee /usr/share/keyrings/githubcli-archive-keyring.gpg >/dev/null \
16
+ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
17
+ > /etc/apt/sources.list.d/github-cli.list \
18
+ && curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc \
19
+ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable" \
20
+ > /etc/apt/sources.list.d/docker.list \
21
+ && apt-get update && apt-get install -y --no-install-recommends gh docker-ce-cli docker-buildx-plugin docker-compose-plugin \
22
+ && rm -rf /var/lib/apt/lists/*
23
+
24
+ # Pi version is pinned in pi/PI_VERSION so a pi bump is a one-file diff
25
+ # teammates pick up on `git pull && garaje up --build`. Bring the file in first
26
+ # as its own layer so editing it busts the cache for the npm install layer
27
+ # below but not for the heavy apt layer above.
28
+ COPY PI_VERSION /tmp/PI_VERSION
29
+
30
+ # pi itself, the garaje CLI (so in-container skills can shell out to `garaje`),
31
+ # plus a TS runner so the @garaje/base package's extensions/*.ts load without a
32
+ # per-start build. --ignore-scripts per the pi install docs.
33
+ RUN PI_VER="$(tr -d '[:space:]' < /tmp/PI_VERSION)" \
34
+ && npm install -g --ignore-scripts \
35
+ "@earendil-works/pi-coding-agent@${PI_VER}" \
36
+ "garaje@__GARAJE_VERSION__" \
37
+ tsx \
38
+ esbuild \
39
+ && rm /tmp/PI_VERSION
40
+
41
+ # Integration auth wiring (see `garaje auth add`). Config is static + non-secret;
42
+ # the token itself lives on the garaje-auth volume at runtime. Placed AFTER the
43
+ # heavy pi/npm layer so editing this doesn't bust that cache. Covers github.com
44
+ # and gist.github.com (mirrors `gh auth setup-git`).
45
+ ENV GH_CONFIG_DIR=/root/.garaje-auth/gh
46
+ RUN git config --system 'credential.https://github.com.helper' '!gh auth git-credential' \
47
+ && git config --system 'credential.https://gist.github.com.helper' '!gh auth git-credential'
48
+
49
+ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
50
+ RUN chmod +x /usr/local/bin/entrypoint.sh
51
+
52
+ WORKDIR /workspace
53
+
54
+ ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/entrypoint.sh"]
55
+ # Stay alive so the TUI can be launched on demand via `docker compose exec pi pi`.
56
+ CMD ["sleep", "infinity"]
@@ -0,0 +1 @@
1
+ 0.80.3
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env bash
2
+ # Entrypoint for the pi container.
3
+ # 1. Ensure the agent home + gh config dir exist.
4
+ # 2. Drop stale extensions/skills/settings.json symlinks from a carried-over
5
+ # pi-config volume (pre-Phase-3 leftovers).
6
+ # 3. Seed global settings with defaultProjectTrust:"always" (the container IS
7
+ # the isolation boundary; the mounted /workspace is trusted). This lets pi
8
+ # auto-install the pinned @garaje/base package and load project resources
9
+ # headlessly, with no trust prompt.
10
+ # 4. Symlink pi's sessions dir to the bind-mounted /workspace/sessions.
11
+ # 5. exec the command (default: `sleep infinity`).
12
+ # NOTE: extensions/skills/settings are NO LONGER symlinked — they arrive via the
13
+ # @garaje/base pi package pinned in .pi/settings.json.
14
+ set -euo pipefail
15
+
16
+ AGENT_DIR="/root/.pi/agent"
17
+ mkdir -p "${AGENT_DIR}"
18
+ mkdir -p "${GH_CONFIG_DIR:-/root/.garaje-auth/gh}"
19
+
20
+ # Drop any stale extensions/skills/settings.json symlinks left over from the
21
+ # pre-Phase-3 symlink dance (they persist on a carried-over pi-config volume).
22
+ # These resources now arrive via the @garaje/base pi package, so a lingering
23
+ # symlink is dead weight that `garaje doctor` flags as a regression. This MUST
24
+ # run before the trust-seed writeFileSync below: a stale settings.json symlink
25
+ # (pre-Phase-3 pointed it at /workspace/.agent/settings.json, now deleted)
26
+ # would otherwise make that write resurrect a file in the working tree.
27
+ for stale in extensions skills settings.json; do
28
+ if [ -L "${AGENT_DIR}/${stale}" ]; then
29
+ rm -f "${AGENT_DIR}/${stale}"
30
+ fi
31
+ done
32
+
33
+ # Merge defaultProjectTrust:"always" into global settings (idempotent).
34
+ AGENT_DIR="${AGENT_DIR}" node -e '
35
+ const fs = require("fs");
36
+ const p = process.env.AGENT_DIR + "/settings.json";
37
+ let s = {};
38
+ try { s = JSON.parse(fs.readFileSync(p, "utf8")); } catch {}
39
+ s.defaultProjectTrust = "always";
40
+ fs.writeFileSync(p, JSON.stringify(s, null, 2) + "\n");
41
+ '
42
+
43
+ # Sessions: transcripts land on the host filesystem.
44
+ if [ -d "/workspace/sessions" ]; then
45
+ rm -rf "${AGENT_DIR}/sessions"
46
+ ln -s "/workspace/sessions" "${AGENT_DIR}/sessions"
47
+ fi
48
+
49
+ exec "$@"