CLI mail directory using normal text editor. Once AI assignment is
ready for processing, you should [[id:883d6e7c-60e0-422b-8c00-5cdc9dfec20d][initiate AI processing]] on that file.
-** joinfiles command
+** "joinfiles" command
The *joinfiles* command is a utility for aggregating the contents of
multiple files into a single document, which can then be processed by
and the title within the document.
The function then constructs a file path by concatenating the
-pre-defined =ai-topic-files-directory= (which should be set to your
-topics directory), the topic name, and the =.org= extension. If a file
-with this path does not already exist, the function will create a new
-file and open it for editing.
+pre-defined =alyverkko-topic-files-directory= (which should be set to
+your topics directory), the topic name, and the =.org= extension. If a
+file with this path does not already exist, the function will create a
+new file and open it for editing.
#+begin_src elisp :results none
buffer in Emacs.
#+begin_src elisp :results none
-(defun alyverkko-compute ()
- "Select a prompt alias interactively and insert it at the beginning of the current buffer."
- (interactive)
- (let ((config-file "~/.config/alyverkko-cli.yaml")
- (aliases '()))
- (with-temp-buffer
- (insert-file-contents config-file)
- ;; Move to the beginning of the prompts section
+ (defun alyverkko-compute ()
+ "Select a prompt alias interactively and insert it at the beginning of the current buffer."
+ (interactive)
+ (let ((config-file "~/.config/alyverkko-cli/alyverkko-cli.yaml")
+ (aliases '()))
+ (with-temp-buffer
+ (insert-file-contents config-file)
+ ;; Move to the beginning of the prompts section
+ (goto-char (point-min))
+ (when (search-forward-regexp "^prompts:" nil t)
+ ;; Collect all aliases
+ (while (search-forward-regexp "^\\s-+- alias: \"\\([^\"]+\\)\"" nil t)
+ (push (match-string 1) aliases))))
+ ;; Let the user choose from the collected aliases
+ (if aliases
+ (let ((selected-alias (completing-read "Select prompt alias: " (reverse aliases))))
+ ;; now insert in original buffer
+ (alyverkko-insert-tocompute-line selected-alias))
+ (message "No prompts found."))))
+
+ (defun alyverkko-insert-tocompute-line (prompt-alias)
+ "Inserts TOCOMPUTE line with selected PROMPT-ALIAS at the beginning of the buffer."
+ (save-excursion ; Preserve the original cursor location in the buffer
(goto-char (point-min))
- (when (search-forward-regexp "^prompts:" nil t)
- ;; Collect all aliases
- (while (search-forward-regexp "^\\s-+- alias: \"\\([^\"]+\\)\"" nil t)
- (push (match-string 1) aliases))))
- ;; Let the user choose from the collected aliases
- (if aliases
- (let ((selected-alias (completing-read "Select prompt alias: " (reverse aliases))))
- ;; now insert in original buffer
- (alyverkko-insert-tocompute-line selected-alias))
- (message "No prompts found."))))
-
-(defun alyverkko-insert-tocompute-line (prompt-alias)
- "Inserts TOCOMPUTE line with selected PROMPT-ALIAS at the beginning of the buffer."
- (save-excursion ; Preserve the original cursor location in the buffer
- (goto-char (point-min))
- (insert (format "TOCOMPUTE: prompt=%s\n" prompt-alias))
- (save-buffer)))
+ (insert (format "TOCOMPUTE: prompt=%s\n" prompt-alias))
+ (save-buffer)))
#+end_src
* TODO
#!/bin/bash
-# Define constants for paths and filenames
-INSTALL_DIR="/opt/alyverkko-cli"
-BINARY="alyverkko-cli"
-DESKTOP_FILE="alyverkko-cli.desktop"
-ICON_FILE="$INSTALL_DIR/logo.png"
-APPLICATIONS_DIR="/usr/share/applications"
-SYSTEM_SERVICE_DIR="/etc/systemd/system"
-CONFIG_DIR="${HOME}/.config/"
-SYSTEM_SERVICE="alyverkko-cli.service"
-
-# Build the application
-mvn --settings maven.xml clean package
-
-# Install the binary and jar
-sudo mkdir -p "$INSTALL_DIR"
-sudo rm -f "$INSTALL_DIR/$BINARY.jar"
-sudo cp target/"$BINARY".jar "$INSTALL_DIR/$BINARY.jar"
-sudo cp "$BINARY" "$INSTALL_DIR/$BINARY"
-
-# Create a symbolic link to run the program from CLI
-sudo rm -f /usr/bin/"$BINARY"
-sudo ln -s "$INSTALL_DIR/$BINARY" /usr/bin/"$BINARY"
-
-# Install the desktop launcher
-cat <<EOF | sudo tee "$APPLICATIONS_DIR/$DESKTOP_FILE" > /dev/null
+SYSTEMD_SERVICE_FILE="/etc/systemd/system/alyverkko-cli.service"
+
+
+# Function to install binary and jar
+install_to_opt() {
+ sudo rm -rf /opt/alyverkko-cli/
+ sudo mkdir -p /opt/alyverkko-cli/
+ sudo chmod 755 /opt/alyverkko-cli/
+
+ sudo cp target/alyverkko-cli.jar "/opt/alyverkko-cli/alyverkko-cli.jar"
+ sudo cp "alyverkko-cli" "/opt/alyverkko-cli/alyverkko-cli"
+ sudo chmod +x "/opt/alyverkko-cli/alyverkko-cli"
+ sudo cp logo.png "/opt/alyverkko-cli/logo.png"
+
+ sudo ln -sf "/opt/alyverkko-cli/alyverkko-cli" /usr/bin/alyverkko-cli
+}
+
+# Function to install the desktop launcher
+install_desktop_entry() {
+ local desktop_entry_path="/usr/share/applications/alyverkko-cli.desktop"
+
+ cat <<EOF | sudo tee "$desktop_entry_path" > /dev/null
[Desktop Entry]
Type=Application
Terminal=true
Name=Älyverkko CLI
Comment=Runner for artificial neural network service
-Icon=$ICON_FILE
-Exec=/opt/alyverkko-cli/$BINARY mail
+Icon=/opt/alyverkko-cli/logo.png
+Exec=/opt/alyverkko-cli/alyverkko-cli mail
Categories=Development;
EOF
-# Make sure the desktop file is executable
-sudo chmod 644 "$APPLICATIONS_DIR/$DESKTOP_FILE"
+ sudo chmod 644 "$desktop_entry_path"
+}
-# Copy the icon (assuming you have an icon named alyverkko-cli.svg)
-sudo cp logo.png "$ICON_FILE"
+# Function to install systemd service
+install_systemd_service() {
-# Pre-deploy example configuration YAML file
-sudo mkdir -p "$CONFIG_DIR"
-
-if [ -f "$CONFIG_DIR/alyverkko-cli.yaml" ]; then
- echo "Configuration file already exists. Skipping pre-deployment."
-else
- sudo cp alyverkko-cli.yaml "$CONFIG_DIR"
-fi
-
-# Check if systemd service already exists
-if [ -f "$SYSTEM_SERVICE_DIR/$SYSTEM_SERVICE" ]; then
- echo "Systemd service is already installed."
- # Display the status without hanging
- echo "Service status is:"
- systemctl --no-pager -l status alyverkko-cli
-else
- # Install systemd service if requested
- echo "Do you want to install Älyverkko CLI as a systemd service? (y/N)"
- read install_service
-
- if [[ $install_service == [Yy] ]]; then
- cat <<EOF | sudo tee "$SYSTEM_SERVICE_DIR/$SYSTEM_SERVICE" > /dev/null
+ cat <<EOF | sudo tee "$SYSTEMD_SERVICE_FILE" > /dev/null
[Unit]
Description=Älyverkko CLI daemon in mail mode
After=network.target
[Install]
WantedBy=multi-user.target
EOF
- sudo systemctl daemon-reload
- sudo systemctl enable alyverkko-cli
- sudo systemctl start alyverkko-cli
- echo "Systemd service installed, enabled and started. Service status is:"
+
+ sudo systemctl daemon-reload
+ sudo systemctl enable alyverkko-cli
+ sudo systemctl start alyverkko-cli
+ sleep 1
+ echo "Systemd service installed, enabled and started. Service status is:"
+ systemctl --no-pager -l status alyverkko-cli
+}
+
+
+# Function to pre-deploy example configuration YAML file
+install_config_file() {
+ local alyverkko_config_dir="${HOME}/.config/alyverkko-cli"
+
+ if [ ! -d "$alyverkko_config_dir" ]; then
+ mkdir -p "$alyverkko_config_dir"
+ cp alyverkko-cli.yaml "$alyverkko_config_dir/"
+ else
+ echo "Configuration directory already exists: $alyverkko_config_dir"
+ fi
+}
+
+# Main installation function
+main() {
+ # Build the application
+ mvn --settings maven.xml clean package
+
+ install_to_opt
+ install_desktop_entry
+ install_config_file
+
+ # Check if systemd service already exists
+ if [ -f "$SYSTEMD_SERVICE_FILE" ]; then
+ echo "Systemd service is already installed."
+ # Display the status without hanging
+ echo "Service status is:"
systemctl --no-pager -l status alyverkko-cli
+ else
+ # Install systemd service if requested
+ echo "Do you want to install Älyverkko CLI as a systemd service? (y/N)"
+ read install_service
+
+ if [[ $install_service == [Yy] ]]; then
+ install_systemd_service
+ fi
fi
-fi
-echo "Installation complete."
+ echo "Installation complete."
+}
+
+# Call the main installation function
+main