From 506b93b5f4f86252eca657379ad2e7aa7907d52e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Nov 2025 12:35:19 +0000 Subject: [PATCH] refactor: Move core aios packages to build.zsh Moved essential aios components to build.zsh (base layer): - sudoers configuration (wheel group permissions) - aigpt install (aios core package) - aibot install (aios core package) - renamed from 'ai' to 'aibot' Updated module responsibilities: - build.zsh: Arch base + aios core packages (required) - setup-user.sh: User customization only - setup-claude.sh: Claude MCP configuration only Benefits: - Clear separation: base vs customization - aigpt/aibot always included (core aios functionality) - Modules can be optionally skipped for customization --- build.zsh | 12 ++++++++++++ cfg/setup-claude.sh | 16 ++++------------ cfg/setup-user.sh | 4 ---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build.zsh b/build.zsh index 1677fd1..a2c017f 100755 --- a/build.zsh +++ b/build.zsh @@ -60,6 +60,18 @@ arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'npm i -g @anthropic-ai # Copy os-release cp -rf ./cfg/os-release root.x86_64/var/lib/machines/arch/etc/os-release +# Configure sudoers for wheel group +echo "Configuring sudoers..." +arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/pacman -Syu --noconfirm, /usr/bin/rm -rf /var/lib/pacman/db.lck, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/machinectl" >> /etc/sudoers' + +# Install aigpt (aios core package) +echo "Installing aigpt..." +arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'git clone https://git.syui.ai/ai/gpt && cd gpt && cargo build --release && cp -rf ./target/release/aigpt /bin/' + +# Install aibot (aios core package) +echo "Installing aibot..." +arch-chroot root.x86_64/var/lib/machines/arch /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/aibot /bin/ && aibot ai' + echo "✓ Arch Linux base complete" echo "" diff --git a/cfg/setup-claude.sh b/cfg/setup-claude.sh index 86be3be..c727420 100755 --- a/cfg/setup-claude.sh +++ b/cfg/setup-claude.sh @@ -1,14 +1,10 @@ #!/bin/bash -# Claude Code and aigpt setup for aios -# Installs aigpt, configures MCP, sets up shared memory +# Claude Code MCP setup for aios +# Configures MCP, sets up shared memory ROOTFS="root.x86_64/var/lib/machines/arch" -echo "=== Claude & aigpt Setup ===" - -# Install aigpt (AI memory system) -echo "Installing aigpt..." -arch-chroot $ROOTFS /bin/sh -c 'git clone https://git.syui.ai/ai/gpt && cd gpt && cargo build --release && cp -rf ./target/release/aigpt /bin/' +echo "=== Claude MCP Setup ===" # Setup Claude Code MCP configuration (shared via symlink) echo "Configuring MCP..." @@ -34,10 +30,6 @@ arch-chroot $ROOTFS /bin/sh -c 'cp /root/.config/syui/ai/claude/claude_desktop_c arch-chroot $ROOTFS /bin/sh -c 'ln -sf /home/ai/.config/syui/ai/claude /home/ai/.config/claude' arch-chroot $ROOTFS /bin/sh -c 'chown -R ai:ai /home/ai/.config/syui' -# Install ai/bot (optional, for backward compatibility) -echo "Installing ai/bot..." -arch-chroot $ROOTFS /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai' - # Create config directory arch-chroot $ROOTFS /bin/sh -c 'mkdir -p /root/.config/syui/ai/gpt' @@ -53,4 +45,4 @@ sleep 2 arch-chroot $ROOTFS /bin/sh -c 'pkill aigpt' arch-chroot $ROOTFS /bin/sh -c 'if command -v sqlite3 &>/dev/null; then sqlite3 /root/.config/syui/ai/gpt/memory.db "PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;"; fi' -echo "✓ Claude & aigpt setup complete" +echo "✓ Claude MCP setup complete" diff --git a/cfg/setup-user.sh b/cfg/setup-user.sh index dae6f93..6147978 100755 --- a/cfg/setup-user.sh +++ b/cfg/setup-user.sh @@ -11,10 +11,6 @@ echo "Creating user 'ai'..." arch-chroot $ROOTFS /bin/sh -c 'useradd -m -G wheel -s /bin/zsh ai' arch-chroot $ROOTFS /bin/sh -c 'echo "ai:root" | chpasswd' -# Enable wheel group for sudo (specific commands without password) -echo "Configuring sudoers..." -arch-chroot $ROOTFS /bin/sh -c 'echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/pacman -Syu --noconfirm, /usr/bin/rm -rf /var/lib/pacman/db.lck, /usr/bin/poweroff, /usr/bin/reboot, /usr/bin/machinectl" >> /etc/sudoers' - # Setup auto-login for user 'ai' echo "Setting up auto-login..." arch-chroot $ROOTFS /bin/sh -c 'mkdir -p /etc/systemd/system/getty@tty1.service.d'