diff --git a/platform-cloud/cloud-sidebar.json b/platform-cloud/cloud-sidebar.json index 126a2a069..f48b83d05 100644 --- a/platform-cloud/cloud-sidebar.json +++ b/platform-cloud/cloud-sidebar.json @@ -158,6 +158,18 @@ "administration/credit-management" ] }, + { + "type": "category", + "label": "Seqera AI CLI", + "collapsed": true, + "items": [ + "seqera-ai/overview", + "seqera-ai/getting-started", + "seqera-ai/installation", + "seqera-ai/authentication", + "seqera-ai/approval-modes" + ] + }, { "type": "category", "label": "Developer tools", diff --git a/platform-cloud/docs/seqera-ai/approval-modes.md b/platform-cloud/docs/seqera-ai/approval-modes.md new file mode 100644 index 000000000..b542e6a2e --- /dev/null +++ b/platform-cloud/docs/seqera-ai/approval-modes.md @@ -0,0 +1,240 @@ +--- +title: "Approval modes" +description: "Control which local commands require user approval in Seqera AI" +date: "15 Dec 2025" +tags: [seqera-ai, cli, approval, security] +--- + +:::caution +Seqera AI is currently in beta. Features and commands may change as we continue to improve the product. +::: + +Approval modes control which local commands Seqera AI can execute automatically and which require your explicit approval. This provides a balance between convenience and safety when working with local files and commands. + +## Understanding approval modes + +When you ask Seqera AI to perform actions on your local machine (edit files, run commands), the approval mode determines whether the action runs immediately or prompts you for confirmation first. + +There are three approval modes: + +| Mode | Description | Best for | +|------|-------------|----------| +| **basic** | Only safe, read-only commands run automatically | Maximum security | +| **default** | Safe commands and workspace file edits run automatically | Typical development | +| **full** | Everything except dangerous commands runs automatically | Experienced users | + +## Setting the approval mode + +### At startup + +Set the approval mode when starting the assistant: + +```bash +# Use basic mode (most restrictive) +seqera ai -a basic + +# Use default mode (balanced) +seqera ai -a default + +# Use full mode (most permissive) +seqera ai -a full +``` + +### During a session + +Change the approval mode at any time using the `/approval` command: + +``` +> /approval basic +Approval mode set to: basic + +> /approval +Current approval mode: basic +``` + +## Mode details + +### Basic mode + +**Rule**: Only safe, read-only commands run automatically. Everything else requires approval. + +This is the most restrictive mode. The assistant can only auto-execute commands that view information without making changes. + +**Auto-executes**: +- `cat` - View file contents +- `ls` - List directory contents +- `pwd` - Show current directory +- `head` - View file beginning +- `tail` - View file end +- `tree` - Display directory tree +- `echo` - Print text (without file redirection) +- `date` - Show current date/time +- `whoami` - Show current user +- `env` - Display environment variables +- `printenv` - Print environment variables +- `stat` - Show file status +- `uptime` - Show system uptime + +**Requires approval**: All other commands, including file edits, directory creation, and any other command execution. Safe commands that include file redirections (e.g., `echo "hello" > file.txt`) also require approval. + +**Use when**: You want maximum control and visibility over every action the assistant takes. + +### Default mode + +**Rule**: Safe commands and file operations within your workspace run automatically. All other commands require approval. + +This is the recommended mode for most users. It allows productive workflow while protecting system files and preventing destructive operations. + +**Auto-executes**: +- All safe commands from basic mode (without file redirections) +- File edits **within your current workspace**: + - Creating files (`touch`, file creation) + - Editing files (text modifications) + - Creating directories (`mkdir`) + - Copying files (`cp` within workspace) + - Moving files (`mv` within workspace) + +**Requires approval**: +- File operations **outside your workspace** +- All dangerous commands (see below) +- Commands with file redirects to paths outside workspace +- All other commands (e.g., `curl`, `wget`, `git`, `npm`, `python`, etc.) + +**Use when**: You're doing typical development work and want convenience without compromising safety. + +### Full mode + +**Rule**: Everything runs automatically except explicitly dangerous commands. + +This is the most permissive mode. Use it when you fully trust the assistant's actions and want minimal interruption. + +**Auto-executes**: All commands except those on the dangerous list. + +**Requires approval**: Only dangerous commands (see below). + +**Use when**: You're an experienced user comfortable with automated command execution, or when working in an isolated/disposable environment. + +## Dangerous commands + +These commands **always require approval** in any mode: + +| Command | Risk | +|---------|------| +| `rm` | Delete files/directories | +| `chmod` | Change file permissions | +| `chown` | Change file ownership | +| `kill` | Terminate processes | +| `killall` | Terminate multiple processes | +| `pkill` | Kill processes by name | +| `sudo` | Execute as superuser | +| `dd` | Low-level data operations | +| `mount` | Mount filesystems | +| `umount` | Unmount filesystems | +| `mkfs` | Create filesystems | +| `reboot` | Restart system | +| `shutdown` | Power off system | + +## Approval prompts + +When a command requires approval, you'll see a prompt like: + +``` +The assistant wants to run: + rm -rf ./build/ + +[A]pprove [R]eject [E]dit +``` + +- **Approve (A)**: Run the command as shown +- **Reject (R)**: Cancel the command +- **Edit (E)**: Modify the command before running + +## Workspace boundaries + +In **default** mode, the "workspace" is your current working directory and its subdirectories. File operations are evaluated as: + +- **Inside workspace**: `/path/to/workspace/src/file.txt` - auto-executes +- **Outside workspace**: `/etc/config` or `~/other-project/file.txt` - requires approval + +The workspace is set when you start the assistant: + +```bash +# Workspace is /home/user/my-project +cd /home/user/my-project +seqera ai + +# Or explicitly set the workspace +seqera ai -w /home/user/my-project +``` + +## Examples + +### Basic mode example + +``` +> Create a new file called test.txt with "hello world" + +The assistant wants to create file: + ./test.txt + +[A]pprove [R]eject [E]dit +``` + +Every file creation requires approval. + +### Default mode example + +``` +> Create a new file called test.txt with "hello world" + +Created ./test.txt +``` + +File creation in the workspace runs automatically. + +``` +> Edit /etc/hosts + +The assistant wants to edit file: + /etc/hosts + +[A]pprove [R]eject [E]dit +``` + +Editing outside the workspace requires approval. + +### Full mode example + +``` +> Create files and directories as needed + +Created ./src/utils.py +Created ./tests/test_utils.py +Created ./config/settings.json +``` + +Most operations run without prompts. + +``` +> Delete the build directory + +The assistant wants to run: + rm -rf ./build/ + +[A]pprove [R]eject [E]dit +``` + +Dangerous commands still require approval. + +## Best practices + +1. **Start with default mode**: It provides a good balance for most workflows +2. **Use basic mode for unfamiliar projects**: When exploring new codebases +3. **Reserve full mode for trusted contexts**: Disposable environments or well-understood tasks +4. **Review dangerous command prompts carefully**: These commands can have significant impact + +## Next steps + +- [Getting started](./getting-started) - Learn the basics +- [Installation](./installation) - Detailed installation instructions +- [Authentication](./authentication) - Login and session management diff --git a/platform-cloud/docs/seqera-ai/authentication.md b/platform-cloud/docs/seqera-ai/authentication.md new file mode 100644 index 000000000..27abe84d1 --- /dev/null +++ b/platform-cloud/docs/seqera-ai/authentication.md @@ -0,0 +1,166 @@ +--- +title: "Authentication" +description: "Login, logout, and session management for Seqera AI CLI" +date: "15 Dec 2025" +tags: [seqera-ai, cli, authentication, login] +--- + +:::caution +Seqera AI is currently in beta. Features and commands may change as we continue to improve the product. +::: + +Seqera AI uses your Seqera Platform account for authentication. This page covers how to login, manage sessions, and logout. + +## Login + +Authenticate with your Seqera Platform account: + +```bash +seqera login +``` + +This will: +1. Open your default browser to the Seqera login page +2. Prompt you to sign in with your Seqera Platform credentials +3. Automatically capture the authentication token +4. Display a success message in your terminal + +``` +Opening browser for authentication... +Successfully authenticated as user@example.com +``` + +## Check session status + +View your current authentication status: + +```bash +seqera status +``` + +This shows: +- Whether you're logged in +- Your authenticated email +- Session details + +``` +Logged in as: user@example.com +Session expires: 2025-12-16 14:30:00 +``` + +## Logout + +### Standard logout + +Sign out from the current session: + +```bash +seqera logout +``` + +This: +- Revokes your authentication token +- Removes locally stored credentials +- Requires re-authentication on next use + +### Clear all sessions + +If you've used multiple profiles or want to completely reset authentication: + +```bash +seqera logout --all +``` + +This removes all stored credentials and session data. + +## How credentials are stored + +Seqera AI stores authentication tokens securely: + +1. **Primary storage**: Your operating system's secure keychain + - macOS: Keychain Access + - Linux: Secret Service (GNOME Keyring, KWallet) + - Windows: Windows Credential Manager + +2. **Fallback storage**: If keychain access isn't available, tokens are stored in: + ``` + ~/.config/seqera-ai/refresh-token. + ``` + +Session metadata (email, login timestamp) is stored in: +``` +~/.config/seqera-ai/auth-state.json +``` + +## Automatic token refresh + +Seqera AI automatically refreshes your authentication token when needed. You don't need to re-login unless: + +- You explicitly logout +- Your refresh token expires (typically after extended inactivity) +- Your Seqera Platform account permissions change + +## Using access tokens (CI/CD) + +For automated environments, you can provide a Seqera Platform access token directly: + +```bash +seqera ai --token +``` + +To get a Platform access token: + +1. Go to [Seqera Platform](https://cloud.seqera.io) +2. Click your profile icon and select **User tokens** +3. Click **Add token** and copy the generated token + +:::caution +Access tokens provide full access to your Platform account. Store them securely and never commit them to version control. Use environment variables or secret management for CI/CD. +::: + +You can also set the token via environment variable: + +```bash +export TOWER_ACCESS_TOKEN= +seqera ai +``` + +## Troubleshooting + +### Browser doesn't open + +If the browser doesn't open automatically: + +1. Check the terminal output for a URL +2. Copy and paste the URL into your browser manually +3. Complete authentication in the browser + +### Login timeout + +If authentication times out: + +1. Ensure you have internet connectivity +2. Check that `https://seqera.io` is accessible +3. Try logging out and logging in again + +### Token storage errors + +If you see keychain-related errors: + +1. Ensure your system keychain service is running +2. Check that you have permission to access the keychain +3. The CLI will automatically fall back to file-based storage + +### Session expired + +If your session has expired: + +```bash +seqera logout +seqera login +``` + +## Next steps + +- [Getting started](./getting-started) - Start using the AI assistant +- [Approval modes](./approval-modes) - Configure command execution settings diff --git a/platform-cloud/docs/seqera-ai/getting-started.md b/platform-cloud/docs/seqera-ai/getting-started.md new file mode 100644 index 000000000..4a11b4294 --- /dev/null +++ b/platform-cloud/docs/seqera-ai/getting-started.md @@ -0,0 +1,298 @@ +--- +title: "Getting started" +description: "Quick start guide for Seqera AI CLI" +date: "15 Dec 2025" +tags: [seqera-ai, cli, ai, getting-started] +--- + +:::caution +Seqera AI is currently in beta. Features and commands may change as we continue to improve the product. +::: + +This guide walks you through installing Seqera AI and running your first commands. + +## Prerequisites + +Before you begin, ensure you have: + +- Python 3.13 or later installed +- A [Seqera Platform](https://cloud.seqera.io) account + +## Step 1: Install the CLI + +Install Seqera AI using pip: + +```bash +pip install seqera-ai +``` + +Verify the installation: + +```bash +seqera --version +``` + +## Step 2: Login to Seqera Platform + +Authenticate with your Seqera Platform account: + +```bash +seqera login +``` + +This opens your browser to complete authentication. Once successful, you'll see a confirmation message in your terminal. + +## Step 3: Start the AI assistant + +Launch the interactive assistant: + +```bash +seqera ai +``` + +You'll see a welcome message and prompt where you can start typing commands in natural language. + +## Working with Nextflow + +Start from your Nextflow project directory to get the most out of Seqera AI: + +```bash +cd /path/to/your/pipeline +seqera ai +``` + +### Understand your pipeline + +``` +> Show me the structure of main.nf +``` + +``` +> What processes are defined in this pipeline? +``` + +### Generate a configuration file + +``` +> /config +``` + +The assistant will analyze your project and create an appropriate nextflow.config file. + +### Debug your pipeline + +``` +> /debug +``` + +Run nextflow lint and preview to check your pipeline for errors. + +``` +> Why is my pipeline failing? +``` + +The assistant analyzes your code and provides insights into what might be wrong. + +### Generate a schema + +``` +> /schema +``` + +Create a nextflow_schema.json file for your pipeline parameters. + +### Convert scripts to Nextflow + +``` +> /convert-python-script +``` + +Convert a Python script in your working directory to a Nextflow process. + +## Working with Seqera Platform + +Once you're ready to run pipelines at scale, use Seqera Platform: + +### List your workflows + +``` +> List my recent workflows +``` + +The assistant will show your recent workflow runs from Seqera Platform. + +### Launch a pipeline + +``` +> Launch the nf-core/rnaseq pipeline with the test profile +``` + +The assistant will guide you through launching a workflow, asking for any required parameters. + +### Debug a failed run + +``` +> Why did my last workflow fail? +``` + +``` +> Get the logs for the failed task in my last run +``` + +The assistant analyzes logs and provides insights into what went wrong and how to fix it. + +## Working with nf-core modules + +Seqera AI provides access to over 1,000 nf-core modules for common bioinformatics tasks: + +### Search for modules + +``` +> Find nf-core modules for sequence alignment +``` + +``` +> What modules are available for variant calling? +``` + +### Get module details + +``` +> Show me how to use the nf-core/bwa/mem module +``` + +The assistant returns detailed information including input/output schemas and ready-to-run Nextflow commands. + +### Run a module + +``` +> Run FastQC on my FASTQ files +``` + +The assistant can generate the exact Nextflow command with proper parameters for your data. + +## Working with data + +Seqera AI helps you manage data through Platform data links and access reference datasets: + +### Browse data links + +``` +> List my data links +``` + +``` +> Show me the contents of my S3 data link +``` + +### Download and upload files + +``` +> Generate a download URL for results/final_report.html +``` + +``` +> Upload my local results to the data link +``` + +### Access reference data + +``` +> Find the human reference genome GRCh38 +``` + +``` +> Search for RNA-Seq test data +``` + +## Building containers with Wave + +Seqera AI can create containerized environments using Wave, without requiring you to write Dockerfiles: + +### Create a container with conda packages + +``` +> Create a container with samtools and bwa from bioconda +``` + +### Create a container with pip packages + +``` +> Build a container with pandas, numpy, and scikit-learn +``` + +### Get a container for a specific tool + +``` +> I need a container with FastQC version 0.12.1 +``` + +The assistant will generate a Wave container URL that you can use directly in your Nextflow pipelines or pull with Docker. + +## Working with local files + +Seqera AI can interact with files in your current working directory. Start the assistant from your project folder: + +```bash +cd /path/to/your/project +seqera ai +``` + +Then ask the assistant to help with local tasks: + +``` +> Show me the structure of main.nf +``` + +``` +> Add a new process to handle quality control +``` + +:::note +Local file operations are controlled by [approval modes](./approval-modes). By default, the assistant will ask for your approval before making changes outside your working directory or running potentially dangerous commands. +::: + +## Using slash commands + +Seqera AI includes built-in slash commands for common workflows. Type `/` to see all available commands: + +| Command | Description | +|---------|-------------| +| `/config` | Generate a nextflow.config file | +| `/schema` | Generate a Nextflow schema | +| `/debug` | Run nextflow lint and preview | +| `/debug-last-run` | Debug the last local run | +| `/debug-last-run-on-seqera` | Debug the last Platform run | +| `/migrate-from-wdl` | Convert WDL to Nextflow | +| `/migrate-from-snakemake` | Convert Snakemake to Nextflow | +| `/convert-python-script` | Convert Python script to Nextflow | +| `/convert-r-script` | Convert R script to Nextflow | +| `/convert-jupyter-notebook` | Convert Jupyter notebook to Nextflow | +| `/write-nf-test` | Write nf-tests for your pipeline | + +## Command-line options + +Customize your session with these options: + +```bash +# Start in a specific directory +seqera ai -w /path/to/project + +# Set approval mode for local commands +seqera ai -a full +``` + +## Exiting the assistant + +To end your session: + +- Type `exit` or `quit` +- Press `Ctrl+C` + +Your conversation history is preserved for the session but not stored permanently. + +## Next steps + +- [Installation](./installation) - Advanced installation options +- [Authentication](./authentication) - Manage login sessions +- [Approval modes](./approval-modes) - Configure command approval settings diff --git a/platform-cloud/docs/seqera-ai/installation.md b/platform-cloud/docs/seqera-ai/installation.md new file mode 100644 index 000000000..493186bd8 --- /dev/null +++ b/platform-cloud/docs/seqera-ai/installation.md @@ -0,0 +1,122 @@ +--- +title: "Installation" +description: "Install and configure Seqera AI CLI" +date: "15 Dec 2025" +tags: [seqera-ai, cli, installation] +--- + +:::caution +Seqera AI is currently in beta. Features and commands may change as we continue to improve the product. +::: + +## System requirements + +- **Python**: 3.13 or later +- **Operating system**: macOS, Linux, or Windows with WSL +- **Network**: Internet connection for authentication and AI services + +### Check your Python version + +```bash +python --version +# or +python3 --version +``` + +If you need to install or upgrade Python, visit [python.org](https://www.python.org/downloads/) or use your system's package manager. + +## Installation + +Install with pip: + +```bash +pip install seqera-ai +``` + +:::tip +Consider using a virtual environment to avoid conflicts with other Python packages: +```bash +python -m venv seqera-env +source seqera-env/bin/activate # On Windows: seqera-env\Scripts\activate +pip install seqera-ai +``` +::: + +## Verify installation + +Confirm Seqera AI is installed correctly: + +```bash +seqera --version +``` + +You should see output like: + +``` +seqera-ai 0.1.0 +``` + +Check available commands: + +```bash +seqera --help +``` + +## Upgrading + +```bash +pip install --upgrade seqera-ai +``` + +## Uninstalling + +```bash +pip uninstall seqera-ai +``` + +## Troubleshooting + +### Command not found + +If you see `seqera: command not found` after installation: + +1. **Check PATH**: Ensure the Python scripts directory is in your PATH + ```bash + # Restart your terminal or run + source ~/.bashrc # or ~/.zshrc + ``` + +2. **Verify installation location**: + ```bash + pip show seqera-ai + ``` + +### Python version errors + +If you see errors about Python version: + +1. Check you have Python 3.13+: + ```bash + python3 --version + ``` + +2. If using multiple Python versions, specify the correct one: + ```bash + python3.13 -m pip install seqera-ai + ``` + +### Permission errors + +If you encounter permission errors during installation: + +```bash +# Use --user flag with pip +pip install --user seqera-ai +``` + +## Next steps + +After installation: + +1. [Authenticate](./authentication) with your Seqera Platform account +2. Start the [AI assistant](./getting-started#step-3-start-the-ai-assistant) diff --git a/platform-cloud/docs/seqera-ai/overview.md b/platform-cloud/docs/seqera-ai/overview.md new file mode 100644 index 000000000..76159fbb5 --- /dev/null +++ b/platform-cloud/docs/seqera-ai/overview.md @@ -0,0 +1,68 @@ +--- +title: "Overview of Seqera AI CLI" +description: "AI-powered assistant for bioinformatics workflows and Seqera Platform" +date: "15 Dec 2025" +tags: [seqera-ai, cli, ai] +--- + +:::caution +Seqera AI is currently in beta. Features and commands may change as we continue to improve the product. +::: + +Seqera AI is an intelligent command-line assistant that helps you build, run, and manage bioinformatics workflows. Powered by advanced AI, it provides an interactive terminal experience for working with Nextflow pipelines and the Seqera Platform. + +## Key features + +- **Natural language interface**: Interact with Seqera Platform using plain English. Ask questions, launch workflows, and manage pipelines through conversational commands. + +- **Workflow management**: Launch, monitor, and debug Nextflow workflows directly from your terminal. Get real-time status updates, view logs, and analyze run metrics. + +- **Pipeline development**: Generate Nextflow configurations, create pipeline schemas, and convert scripts from other workflow languages (WDL, Snakemake) to Nextflow. + +- **nf-core integration**: Search and discover nf-core modules, get detailed execution information, and access ready-to-run Nextflow commands for over 1,000 standardized bioinformatics tools. + +- **Data management**: Browse cloud storage through data links, manage datasets, generate download and upload URLs, and access reference genomes and sequencing data. + +- **Wave containers**: Build containerized environments on-the-fly with conda packages, pip packages, or custom Docker images. Create reproducible containers for your bioinformatics tools without writing Dockerfiles. + +- **Local file operations**: Edit files, run commands, and manage your local development environment with AI assistance and configurable approval modes. + +- **Seqera Platform integration**: Full access to Platform capabilities including compute environments, datasets, data links, and workspace management. + +## How it works + +Seqera AI runs as a local CLI tool that connects to the Seqera AI backend service. When you start a session, the assistant has access to: + +1. **Your Seqera Platform workspace** - View and manage workflows, pipelines, and data through your authenticated account. +2. **Your local environment** - Execute commands and edit files in your working directory (with configurable approval controls). +3. **AI capabilities** - Natural language understanding, code generation, and intelligent suggestions. + +## Getting started + +Install the CLI and start your first session in minutes: + +```bash +# Install the CLI +pip install seqera-ai + +# Login to your Seqera account +seqera login + +# Start the AI assistant +seqera ai +``` + +See [Getting started](./getting-started) for a complete walkthrough. + +## Requirements + +- Python 3.13 or later +- A Seqera Platform account ([sign up for free](https://cloud.seqera.io)) +- macOS, Linux, or Windows with WSL + +## Learn more + +- [Getting started](./getting-started) - Quick start guide with examples +- [Installation](./installation) - Detailed installation instructions +- [Authentication](./authentication) - Login, logout, and session management +- [Approval modes](./approval-modes) - Control which commands run automatically