Add minio-upload skill and update README.md to match actual project structure
This commit is contained in:
59
skills/minio-upload/SKILL.md
Normal file
59
skills/minio-upload/SKILL.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: minio-upload
|
||||
description: Upload files to MinIO obsidian bucket with configurable path support. Use when the user asks to upload files to MinIO, transfer to obsidian bucket specifically, upload markdown or other files to cloud storage, or specify custom subpaths within obsidian bucket
|
||||
---
|
||||
|
||||
# MinIO Upload
|
||||
|
||||
Upload files to the MinIO obsidian bucket with flexible path configuration.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Upload a file to the default `main` path:
|
||||
```bash
|
||||
.claude/skills/minio-upload/scripts/upload_to_obsidian.sh path/to/file.md
|
||||
```
|
||||
|
||||
Upload to a custom subpath:
|
||||
```bash
|
||||
.claude/skills/minio-upload/scripts/upload_to_obsidian.sh path/to/file.md "notes/2024"
|
||||
```
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **Verify file exists** - Check that the source file is accessible
|
||||
2. **Determine target path** - Use specified subpath or default to `main`
|
||||
3. **Upload with mc** - Execute `mc cp` command to transfer file
|
||||
4. **Confirm success** - Verify upload completed and report target location
|
||||
|
||||
## Path Configuration
|
||||
|
||||
The script accepts an optional subpath argument:
|
||||
|
||||
- **Default**: Files upload to `minio/obsidian/main/`
|
||||
- **Custom subpath**: Specify any subpath (e.g., `notes/2024`, `archive/old projects`)
|
||||
- **Nested paths**: Multi-level paths are supported (e.g., `notes/personal/journal`)
|
||||
|
||||
The script automatically:
|
||||
- Appends the filename to the target path
|
||||
- Normalizes multiple slashes in paths
|
||||
- Uses the `minio` alias configured in mc
|
||||
|
||||
## Error Handling
|
||||
|
||||
The script will:
|
||||
- Exit with error if file doesn't exist
|
||||
- Exit with error if no file argument provided
|
||||
- Propagate any mc command failures
|
||||
|
||||
## Resources
|
||||
|
||||
### scripts/upload_to_obsidian.sh
|
||||
|
||||
Bash script that handles the upload process. Validates inputs, constructs the target path, and executes the mc copy command.
|
||||
|
||||
**Key features:**
|
||||
- Default to `main` path when no subpath specified
|
||||
- Support nested subpaths with proper path normalization
|
||||
- Clear error messages for invalid inputs
|
||||
- Success confirmation with source and target paths
|
||||
44
skills/minio-upload/scripts/upload_to_obsidian.sh
Executable file
44
skills/minio-upload/scripts/upload_to_obsidian.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Upload files to MinIO obsidian bucket
|
||||
# Usage: upload_to_obsidian.sh <file_path> [subpath]
|
||||
#
|
||||
# Arguments:
|
||||
# file_path - Path to the file to upload
|
||||
# subpath - Optional subpath within obsidian bucket (default: main)
|
||||
#
|
||||
# Examples:
|
||||
# upload_to_obsidian.sh temp/file.md
|
||||
# upload_to_obsidian.sh temp/file.md notes/2024
|
||||
# upload_to_obsidian.sh temp/file.md "archive/old projects"
|
||||
|
||||
set -e
|
||||
|
||||
# Check arguments
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: $0 <file_path> [subpath]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
FILE_PATH="$1"
|
||||
SUBPATH="${2:-main}" # Default to 'main' if not specified
|
||||
|
||||
# Validate file exists
|
||||
if [ ! -f "$FILE_PATH" ]; then
|
||||
echo "Error: File '$FILE_PATH' does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get filename
|
||||
FILENAME=$(basename "$FILE_PATH")
|
||||
|
||||
# Construct target path
|
||||
TARGET_PATH="minio/obsidian/${SUBPATH}/${FILENAME}"
|
||||
|
||||
# Ensure subpath ends without trailing slash for mc
|
||||
TARGET_PATH=$(echo "$TARGET_PATH" | sed 's://*:/:g')
|
||||
|
||||
# Upload file
|
||||
mc cp "$FILE_PATH" "$TARGET_PATH"
|
||||
|
||||
echo "✅ Uploaded: $FILE_PATH -> $TARGET_PATH"
|
||||
Reference in New Issue
Block a user