diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index a12f3f613d..8b5668a408 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -7,6 +7,7 @@ RUN dnf install -y git gh gcc clang python3 python3-pip emacs-nox fish util-linu RUN dnf install -y qemu-kvm qemu-img RUN dnf install -y openssl openssl-devel awscli redis RUN dnf install -y dnf-plugins-core +RUN dnf install -y lolcat toilet # Install 'docker' RUN sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo diff --git a/.devcontainer/config.fish b/.devcontainer/config.fish index 29be5c59dd..57dcb7bd03 100644 --- a/.devcontainer/config.fish +++ b/.devcontainer/config.fish @@ -45,7 +45,7 @@ set -gx PATH $PATH /home/me/.local/bin # add stuff to path set -gx PATH $PATH $HOME/isomorphic_copy/bin -set -gx DENO_INSTALL /home/me/.deno +set -gx DENO_INSTALL /home/me/.deno set -gx PATH $PATH $DENO_INSTALL/bin # enable vi support @@ -72,7 +72,20 @@ fish_add_path ~/.ops/bin # Assume the daemon is running when entering emacs. # For fast config reloading. -alias platform "emacsclient -e '(kill-emacs)'; emacs -q --daemon -l ~/aesthetic-computer/dotfiles/dot_config/emacs.el; emacsclient -c --eval '(aesthetic-backend (quote \"shell\"))'" +# alias platform "emacs -q --daemon -l ~/aesthetic-computer/dotfiles/dot_config/emacs.el; emacsclient -nw -c --eval '(aesthetic-backend (quote \"source\"))'; emacsclient -e \"(kill-emacs)\"" +alias platform "emacs -q -l ~/aesthetic-computer/dotfiles/dot_config/emacs.el -nw --eval '(aesthetic-backend (quote \"source\"))'" + +# ā²ļø Wait on `entry.fish` to touch the `.waiter` file. +function aesthetic + clear + while not test -f /home/me/.waiter + toilet "Configuring..." -f smblock | lolcat -x -r + sleep 1 + clear + end + rm /home/me/.waiter + platform +end alias ac 'cd ~/aesthetic-computer' alias ac-site 'npm run site' @@ -138,4 +151,4 @@ function forget echo "umm, i forgot :)" end -alias nvm forget \ No newline at end of file +alias nvm forget diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9fc2303a0e..cae7a7c46b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,6 +9,9 @@ }, "platform": "linux/amd64" }, + "containerEnv": { + "DOCKER_CLI_HINTS": "false" + }, "mounts": [ "source=${localWorkspaceFolder}/.devcontainer/.emacs.d,target=/home/me/.emacs.d,type=bind,consistency=cached", "source=${localWorkspaceFolder}/.devcontainer/envs,target=/home/me/envs,type=bind,consistency=cached", @@ -19,17 +22,20 @@ "customizations": { "vscode": { "extensions": [ - "aesthetic-computer.aesthetic-computer-code", // Aesthetic Computer - "fabiospampinato.vscode-terminals", // Terminal Automation - "esbenp.prettier-vscode", // PrettierJS formatting. - "ms-azuretools.vscode-docker", // Docker support. - "mongodb.mongodb-vscode", // MongoDB - "denoland.vscode-deno", // Deno runtime plugin. - "bmalehorn.vscode-fish" // Fish syntax support. + "aesthetic-computer.aesthetic-computer-code", + "fabiospampinato.vscode-terminals", + "esbenp.prettier-vscode", + "ms-azuretools.vscode-docker", + "mongodb.mongodb-vscode", + "denoland.vscode-deno", + "bmalehorn.vscode-fish", + "ms-vsliveshare.vsliveshare", + "jsynowiec.vscode-insertdatestring" ] } }, "runArgs": [ + "-q", "--privileged", "--hostname", "aesthetic", @@ -39,5 +45,5 @@ // "--platform", // "linux/amd64" ], - "postCreateCommand": "fish /entry.fish" + "postCreateCommand": ["fish", "/entry.fish"] } diff --git a/.devcontainer/entry.fish b/.devcontainer/entry.fish index 3398d2a1d7..2af279af25 100644 --- a/.devcontainer/entry.fish +++ b/.devcontainer/entry.fish @@ -8,7 +8,7 @@ end set -gx TERM xterm-256color # Send a welcome message! -echo "*** Aesthetic Computer is Initializing... ***" +toilet "*** Aesthetic Computer ***" -f smblock | lolcat -x -r # Go to the user's directory. cd /home/me @@ -42,14 +42,20 @@ if test -d /home/me/aesthetic-computer cd /home/me/aesthetic-computer/aesthetic-computer-vault sudo fish devault.fish else - echo "Vault mounted :)" + cd /home/me/aesthetic-computer/aesthetic-computer-vault + git pull + sudo fish devault.fish + echo "šŸ”“ Vault mounted." end else - echo "Vault unmounted :(" + echo "āš ļøšŸ”’ Vault unmounted!" end if not test -d /home/me/aesthetic-computer/aesthetic-computer-code gh repo clone whistlegraph/aesthetic-computer-code /home/me/aesthetic-computer/aesthetic-computer-code +else + cd /home/me/aesthetic-computer/aesthetic-computer-vault + git pull end # generate ssl certificates (if they don't already exist) @@ -92,16 +98,25 @@ if test -f /home/me/aesthetic-computer/ssl-dev/localhost.pem; and test -f /home/ end -# Check if node_modules directory is present and not empty -if not test -d /home/me/aesthetic-computer/node_modules || not count (ls /home/me/aesthetic-computer/node_modules) >/dev/null - # Initialize fnm and use the specified Node.js version. - cd /home/me/aesthetic-computer +# Set the directory path +set project_path /home/me/aesthetic-computer + +# Check if node_modules directory exists and is not empty +if not test -d $project_path/node_modules || not count $project_path/node_modules/* >/dev/null + # Move to the project directory + cd $project_path + # Informing about the empty or missing node_modules directory echo "node_modules directory is empty or missing, running npm install." - # Install latest npm version before doing anything. + # Install the latest npm version npm install -g npm@latest --no-fund --no-audit - # Install Node.js dependencies - npm install --no-fund --no-audit + # Install Node.js dependencies using npm ci for a clean install + npm ci --no-fund --no-audit + # Run additional installation scripts npm run install:everything-else else - echo "node_modules directory is present, skipping npm install." -end \ No newline at end of file + # Notify that installation steps are being skipped + echo "node_modules directory is present and not empty, skipping npm install." +end + +# Trigger the 'waiter' alias to boot the platform. +touch /home/me/.waiter \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e69de29bb2..b3e289b668 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -0,0 +1,20 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "šŸ’» Aesthetic Platform", + "type": "shell", + "command": "aesthetic", + "problemMatcher": [], + "presentation": { + "reveal": "always", + "panel": "new", + "focus": true, + "clear": true + }, + "runOptions": { + "runOn": "folderOpen" + } + } + ] +} \ No newline at end of file diff --git a/dotfiles/dot_config/emacs.el b/dotfiles/dot_config/emacs.el index 1805a8d504..e2ff35343e 100644 --- a/dotfiles/dot_config/emacs.el +++ b/dotfiles/dot_config/emacs.el @@ -531,8 +531,6 @@ ;; (add-hook 'vterm-mode-hook 'disable-evil-in-vterm) -;; Kill any active processes when quitting emacs. -(setq confirm-kill-processes nil) ;; (defun aesthetic-internal () ;; "Run aesthetic servers in a docker container that's running emacs." @@ -540,6 +538,11 @@ ;; (eat "fish -c 'npm run site'") ;; (with-current-buffer "*eat*" (rename-buffer "eat-site" t))) +(setq confirm-kill-processes nil) ;; Avoid confirmation for killing processes + +;; Bind the shutdown function to a key (e.g., C-c C-x for example purposes) +;; (global-set-key (kbd "C-c C-x") 'shutdown-emacs-server) + ;; Updated function with emojis for tab names (defun aesthetic-backend (target-tab) "Run npm commands in eat, each in a new tab named after the command. Use 'prompt' for 'shell' and 'url' in split panes, and 'stripe' for 'stripe-print' and 'stripe-ticket'." @@ -547,7 +550,7 @@ (let ((directory-path "~/aesthetic-computer/micro") (commands '("shell" "site" "session" "redis" "edge" "stripe-print" "stripe-ticket" "servers" "chat")) (emoji-for-command - '(("shell" . "🐚") ("site" . "šŸ“°") ("session" . "šŸ”’") ("redis" . "šŸ”„") ("edge" . "šŸ“¶") ("stripe-print" . "šŸ’³ šŸ–Øļø") ("stripe-ticket" . "šŸ’³šŸŽ«") ("servers" . "šŸ¤–") ("chat" . "šŸ’¬"))) + '(("source" . "šŸ“‚") ("shell" . "🐚") ("site" . "šŸ“°") ("session" . "šŸ”’") ("redis" . "šŸ”„") ("edge" . "šŸ“¶") ("stripe-print" . "šŸ’³ šŸ–Øļø") ("stripe-ticket" . "šŸ’³šŸŽ«") ("servers" . "šŸ¤–") ("chat" . "šŸ’¬"))) prompt-tab-created stripe-tab-created) (tab-rename "šŸ“‚ source") (find-file "~/aesthetic-computer/README.txt") diff --git a/install.mjs b/install.mjs index bea3dfc7ff..0bd4ea4cb9 100644 --- a/install.mjs +++ b/install.mjs @@ -11,7 +11,7 @@ const __dirname = dirname(__filename); // Function to execute npm install using spawn for real-time output const runNpmInstall = (dir) => { return new Promise((resolve, reject) => { - const childProcess = spawn("npm", ["install"], { + const childProcess = spawn("npm", ["ci"], { cwd: dir, stdio: "inherit", }); diff --git a/micro/machine/.emacs.d/.gitignore b/micro/machine/.emacs.d/.gitignore deleted file mode 100644 index 2aafa7b8d8..0000000000 --- a/micro/machine/.emacs.d/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore everything in this directory -* diff --git a/micro/machine/Dockerfile b/micro/machine/Dockerfile deleted file mode 100644 index 9379af5547..0000000000 --- a/micro/machine/Dockerfile +++ /dev/null @@ -1,78 +0,0 @@ -# Get the latest fedora version. -FROM fedora:latest -# Update all packages. -RUN dnf update -y - -RUN dnf install -y which tree procps-ng coreutils xclip xsel unzip jq bat -RUN dnf install -y git gh gcc clang python3 python3-pip emacs-nox fish util-linux-user -RUN dnf install -y qemu-kvm qemu-img -RUN dnf install -y openssl awscli redis -RUN dnf install -y dnf-plugins-core - -# Add 'me' user. -RUN useradd -m me && \ - # Optional: Set password for the user (replace 'password' with your desired password) - # echo "me:micro" | chpasswd && \ - # Give 'me' sudo privileges without password - echo "me ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers - -RUN chsh -s /usr/bin/fish me - -# Download and install the Stripe CLI -RUN curl -sL https://github.com/stripe/stripe-cli/releases/download/v1.19.4/stripe_1.19.4_linux_x86_64.tar.gz | tar xz -C /usr/local/bin - -# Install mkcert -RUN curl -L https://github.com/FiloSottile/mkcert/releases/download/v1.4.4/mkcert-v1.4.4-linux-amd64 -o /usr/local/bin/mkcert && \ - chmod +x /usr/local/bin/mkcert - -# Install websocat -RUN dnf copr enable atim/websocat -y && sudo dnf install -y websocat - -# Switch to current user. -USER me - -# Set working directory to me user. -WORKDIR /home/me - -# Copy the fish configuration and entry point script. -RUN mkdir -p .config/fish && \ - mkdir -p .config/fish/conf.d - -# Install fnm -RUN curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "/home/me/.fnm" --skip-shell -ENV PATH="/home/me/.fnm:$PATH" -RUN eval "$(fnm env --use-on-cd)" && \ - fnm install lts-hydrogen && fnm use lts-hydrogen && \ - npm install -g prettier typescript typescript-language-server - -# Install shell-gpt for the user. -RUN pip3 install shell-gpt - -# Install aider: https://github.com/paul-gauthier/aider?tab=readme-ov-file#getting-started -RUN pip3 install aider-chat - -# Install OPS and Nanos: https://nanos.org/getting_started -RUN curl https://ops.city/get.sh -sSfL | sh - -# Copy over a custom xdg-open for opening browser URLs on the host. -COPY xdg-open.fish /usr/local/bin/xdg-open -RUN sudo chmod +x /usr/local/bin/xdg-open - -# Clone isomorphic copy. -# Must also be cloned in ~ of host machine and add isomorphic_copy/bin to PATH -RUN git clone https://github.com/ms-jpq/isomorphic_copy - -# Copy emacs config. -COPY emacs.el .emacs -RUN sudo chown me:me .emacs -RUN mkdir -p .emacs.d - -COPY config.fish .config/fish/config.fish - -COPY entry.fish /entry.fish - -# Set the default command. -CMD ["/usr/bin/fish"] - -# Set the entry point script. -ENTRYPOINT ["/usr/bin/fish", "/entry.fish"] diff --git a/micro/machine/config.fish b/micro/machine/config.fish deleted file mode 100644 index 07cef04d57..0000000000 --- a/micro/machine/config.fish +++ /dev/null @@ -1,123 +0,0 @@ -if test -f $HOME/.fnm/fnm - set -gx PATH $HOME/.fnm $PATH - fnm env --use-on-cd --log-level=quiet | source -end - -function fish_greeting - if test "$nogreet" = true - return - end - - printf "\n🧩 Hi @$AESTHETIC!\n\n" - printf "Ask with 'umm' and forget with 'nvm'\n" - printf "or use 'code' and 'done' with 'copy'\n" - printf "to generate and get code.\n\n" - - printf "šŸ†• Try 'aider' to make edits: https://github.com/paul-gauthier/aider?tab=readme-ov-file#usage\n\n" -end - -# always start in aesthetic-computer directory if there was a greeting -if not test "$nogreet" = true - cd ~/aesthetic-computer -end - -# rebuild the container after exiting with a special code ;) -alias reload 'exit 70' - -# set default editor to emacs -set -gx TERM xterm-256color -set -gx EDITOR emacs -set -gx PATH $PATH /home/me/.local/bin -set -gx PATH $PATH $HOME/isomorphic_copy/bin - -# enable vi support -set fish_cursor_default block -set fish_cursor_insert line -set fish_cursor_replace_one underscore -set fish_vi_force_cursor true -fish_vi_key_bindings - -# add homebrew to path (only if we are on linux) -#switch (uname) -# case Linux -# eval (/home/linuxbrew/.linuxbrew/bin/brew shellenv) -#end - -# include user binaries in the shell path -fish_add_path ~/.local/bin - -# add rust binaries to the shell path -fish_add_path ~/.cargo/bin - -# add nanos ops binaries to the shell path -fish_add_path ~/.ops/bin - -# Assume the daemon is running when entering emacs. -# For fast config reloading. -alias load "emacsclient -e '(kill-emacs)'; emacs -q --daemon -l ~/aesthetic-computer/dotfiles/dot_config/emacs.el; emacsclient -c --eval '(aesthetic-backend)'" - -alias ac 'cd ~/aesthetic-computer' -alias ac-site 'npm run site' -alias ac-session 'npm run server:session' -alias ac-edge 'clear; npm run edge-micro' # TODO: will not return to fish 24.04.05.19.53 :( -alias ac-stripe-print 'npm run stripe-print-micro' -alias ac-stripe-ticket 'npm run stripe-ticket-micro' -alias ac-url 'clear; npm run -s url' -alias ac-shell 'ac-url; fish' -alias ac-redis 'clear; npm run redis' -alias ac-udp 'ssh root@157.245.134.225' # ac monolith udp server management -alias ac-servers 'clear; npm run -s servers; cd nanos; env nogreet=true fish' -alias ac-chat 'clear; npm run -s chat; cd nanos; npm run chat-system:dev; fish' - -alias acw 'cd ~/aesthetic-computer/system; npm run watch' - -alias cat 'bat -p' # use bat for syntax highlighting instead of the `cat` default - -# a shell-gpt shortcut (must be all lowercase / otherwise quoted) -function umm - # Use string escape to handle special characters - set -l args (string join " " $argv) - - # Pass the joined, escaped string to sgpt - sgpt --chat umm "$args" -end - -function umms - sgpt --show-chat umm -end - -function code - if set -q argv[1] - set -l args (string join " " $argv) - sgpt --code --chat code "$args" - else - sgpt --code --editor --chat code - end -end - -function codes - sgpt --show-chat code -end - -function copy - # Extract everything from the chat after the last "assistant: " line. - set content (sgpt --show-chat code | tac | sed '/^assistant: /q' | tac | sed '1s/^assistant: //') - printf "%s\n" $content | xclip -selection clipboard -end - -function done - rm /tmp/chat_cache/code 2>/dev/null - echo "bye :)" -end - -function ok - rm /tmp/chat_cache/umm 2>/dev/null - echo "bye :)" -end - -function forget - rm /tmp/chat_cache/umm 2>/dev/null - echo "umm, i forgot :)" -end - -alias nvm forget diff --git a/micro/machine/entry.fish b/micro/machine/entry.fish deleted file mode 100644 index 4a53d8e306..0000000000 --- a/micro/machine/entry.fish +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env fish -set -gx TERM xterm-256color - -# Send a welcome message! -echo "*** Aesthetic Computer is Initializing... ***" - -# Go to the user's directory. -cd /home/me - -# Login to Github. -if not gh auth status - echo "Not logged into GitHub, exiting to shell." - return -end - -if test -n "$GIT_USER_EMAIL" - git config --global user.email $GIT_USER_EMAIL -end - -if test -n "$GIT_USER_NAME" - git config --global user.name $GIT_USER_NAME -end - -# Add aesthetic-computer as the "safe" directory. -git config --global --add safe.directory /home/me/aesthetic-computer - -# Make sure git is setup and authorized for making commits via `gh`. -gh auth setup-git - -# Apply the 'vault' credentials to the mounted aesthetic-computer volume, and make sure it exists. -if test -d /home/me/aesthetic-computer - if not test -d /home/me/aesthetic-computer/aesthetic-computer-vault - gh repo clone whistlegraph/aesthetic-computer-vault /home/me/aesthetic-computer/aesthetic-computer-vault - cd /home/me/aesthetic-computer/aesthetic-computer-vault - sudo fish devault.fish - echo "šŸ”“ Vault mounted." - else - cd /home/me/aesthetic-computer/aesthetic-computer-vault - sudo fish devault.fish - echo "šŸ”“ Vault mounted." - end -else - echo "āš ļøšŸ”’ Vault unmounted!" -end - -if not test -d /home/me/aesthetic-computer/aesthetic-computer-code - gh repo clone whistlegraph/aesthetic-computer-code /home/me/aesthetic-computer/aesthetic-computer-code -end - -# generate ssl certificates (if they don't already exist) -cd /home/me/aesthetic-computer/ssl-dev - -# Check if the files exist in ssl-dev directory -if not test -f localhost.pem; or not test -f localhost-key.pem - # Generate SSL certificates - sudo fish fedora-install.fish -end - -# Check if the nanos/ssl directory exists, create it if not -if not test -d /home/me/aesthetic-computer/nanos/ssl - mkdir -p /home/me/aesthetic-computer/nanos/ssl -end - -# Check if the files exist in nanos/ssl directory, copy if not -if not test -f /home/me/aesthetic-computer/nanos/ssl/localhost.pem; or not test -f /home/me/aesthetic-computer/nanos/ssl/localhost-key.pem - cp localhost.pem /home/me/aesthetic-computer/nanos/ssl/ - cp localhost-key.pem /home/me/aesthetic-computer/nanos/ssl/ -end - -# Function to install and trust certificates -function install_and_trust_certificate - set certificate_path $argv[1] - set certificate_key_path $argv[2] - set certificate_dir /etc/pki/ca-trust/source/anchors/ - - # Copy the certificate to the system trust store - sudo cp $certificate_path $certificate_dir - sudo cp $certificate_key_path $certificate_dir - - # Update the trust store - sudo update-ca-trust -end - -# Install and trust certificates if they are in ssl-dev directory -if test -f /home/me/aesthetic-computer/ssl-dev/localhost.pem; and test -f /home/me/aesthetic-computer/ssl-dev/localhost-key.pem - install_and_trust_certificate /home/me/aesthetic-computer/ssl-dev/localhost.pem /home/me/aesthetic-computer/ssl-dev/localhost-key.pem -end - -# Initialize fnm and use the specified Node.js version. -cd /home/me/aesthetic-computer - -# Check if node_modules directory is present and not empty -if not test -d node_modules || not count (ls node_modules) >/dev/null - echo "node_modules directory is empty or missing, running npm install." - # Install latest npm version before doing anything. - npm install -g npm@latest --no-fund --no-audit - # Install Node.js dependencies - npm install --no-fund --no-audit - npm run install:everything-else -else - echo "node_modules directory is present, skipping npm install." -end - -fish -- knotmirror 0.0.1 From 837578c7d2fae0e9392c94a383c276985f87a230 Mon Sep 17 00:00:00 2001 From: Jeffrey Alan Scudder Date: Tue, 23 Apr 2024 07:45:46 +0000 Subject: [PATCH 2/3] readme --- README.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.txt b/README.txt index f1ab9647f8..ca0b2a1d2c 100644 --- a/README.txt +++ b/README.txt @@ -42,6 +42,11 @@ but technically agnostic. (Choose your aesthetic!) - Jeffrey (Sat) +*** dev environment *** + - [ā¤ļøā€šŸ”„] Can't kill and re-open platform in the devcontainer... + - [] The eat shells seem to stay open? + - [] https://elpa.nongnu.org/nongnu-devel/doc/eat.html#Shell-Integration + *** aesthetic lisp / s-expression parser and evaluator *** - [-] Make a basic graphical editor / viewer. + Done -- knotmirror 0.0.1 From 99744499b642e4926071c9c968d5f1788f20ee52 Mon Sep 17 00:00:00 2001 From: Jeffrey Alan Scudder Date: Tue, 23 Apr 2024 07:48:23 +0000 Subject: [PATCH 3/3] add org mode --- .devcontainer/devcontainer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index cae7a7c46b..fbe9831d1d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -30,7 +30,8 @@ "denoland.vscode-deno", "bmalehorn.vscode-fish", "ms-vsliveshare.vsliveshare", - "jsynowiec.vscode-insertdatestring" + "jsynowiec.vscode-insertdatestring", + "tootone.org-mode" ] } },