fix: format files to pass lint checks

This commit is contained in:
Noah Brier
2025-09-17 16:06:52 -04:00
parent aadd6cae4b
commit 8773dcff33
3 changed files with 107 additions and 75 deletions
+23 -4
View File
@@ -1,13 +1,16 @@
# download-attachment
Download files from URLs to attachments folder and organize them with descriptive names.
Download files from URLs to attachments folder and organize them with
descriptive names.
## Usage
```
/download-attachment <url1> [url2] [url3...]
```
## Examples
```
/download-attachment https://example.com/document.pdf
/download-attachment https://site.com/image.png https://site.com/report.pdf
@@ -15,13 +18,17 @@ Download files from URLs to attachments folder and organize them with descriptiv
## Implementation
You are tasked with downloading files from URLs and organizing them in the Obsidian vault attachments folder.
You are tasked with downloading files from URLs and organizing them in the
Obsidian vault attachments folder.
### Step 1: Parse and Validate URLs
Extract the URL(s) from the user's input. Handle multiple URLs if provided.
- **Validate URL scheme**: Only allow http:// or https:// URLs
- **Reject invalid URLs**: file://, ftp://, or malformed URLs
- **Example validation**:
```bash
if [[ ! "$url" =~ ^https?:// ]]; then
echo "Error: Only HTTP/HTTPS URLs are allowed"
@@ -30,7 +37,9 @@ fi
```
### Step 2: Download Files
For each URL:
```bash
# Sanitize filename to prevent path traversal
# Remove ../ and other dangerous characters
@@ -43,29 +52,39 @@ curl --max-time 30 -L "$url" -o "05_Attachments/$filename"
```
### Step 3: Verify Downloads
Check that files were downloaded successfully:
```bash
ls -la "05_Attachments/"
```
### Step 4: Organize Files
After downloading, run the organize-attachments command to rename files with descriptive names:
After downloading, run the organize-attachments command to rename files with
descriptive names:
For PDFs:
- Extract text with `pdftotext`
- Analyze content for meaningful title
For Images:
- Use `mcp__gemini-vision__analyze_image` or `mcp__gemini-vision__analyze_multiple`
- Use `mcp__gemini-vision__analyze_image` or
`mcp__gemini-vision__analyze_multiple`
- Generate descriptive filename based on content
### Step 5: Move to Organized
Move renamed files to `05_Attachments/Organized/` with descriptive names
### Step 6: Update Index
Add entries to `05_Attachments/00_Index.md`
### Step 7: Commit Changes
```bash
git add -A
git commit -m "Download and organize attachments from URLs"
+14 -2
View File
@@ -1,14 +1,17 @@
# Pull Request Command
Creates a new feature branch, commits changes, pushes to GitHub, and opens a pull request - all in one command. Perfect for contributing features or fixes.
Creates a new feature branch, commits changes, pushes to GitHub, and opens a
pull request - all in one command. Perfect for contributing features or fixes.
## Task
Automate the entire pull request workflow: create branch, stage changes, commit with descriptive message, push to GitHub, and open PR with proper description.
Automate the entire pull request workflow: create branch, stage changes, commit
with descriptive message, push to GitHub, and open PR with proper description.
## Process
### 1. **Check Prerequisites**
- Ensure git repository exists
- Check for uncommitted changes to include
- Verify GitHub CLI (`gh`) is available
@@ -16,6 +19,7 @@ Automate the entire pull request workflow: create branch, stage changes, commit
- If already on feature branch, ask: "Create PR from current branch?"
### 2. **Create Feature Branch**
```bash
# Generate branch name from PR title or use provided name
# Sanitize branch name: lowercase, replace spaces with hyphens, remove special chars
@@ -32,15 +36,18 @@ Automate the entire pull request workflow: create branch, stage changes, commit
```
### 3. **Stage and Review Changes**
- Show `git status` to user
- Show `git diff --staged` for review
- If no staged changes, stage all changes: `git add -A`
- Confirm changes with user before proceeding
### 4. **Commit Changes**
- Analyze changes to create meaningful commit message
- Use conventional commits format (feat:, fix:, docs:, etc.)
- Include detailed commit body if changes are complex
```bash
git commit -m "feat: add new feature
@@ -51,13 +58,16 @@ Automate the entire pull request workflow: create branch, stage changes, commit
```
### 5. **Push to GitHub**
```bash
# Push with upstream tracking
git push -u origin feature/[branch-name]
```
### 6. **Create Pull Request**
Use `gh pr create` with:
- Descriptive title
- Detailed body with:
- Summary of changes
@@ -92,6 +102,7 @@ Automate the entire pull request workflow: create branch, stage changes, commit
```
### 7. **Provide Next Steps**
- Show PR URL
- Remind about review process
- Suggest next actions (request review, add labels, etc.)
@@ -142,6 +153,7 @@ Next steps:
## Commit Message Format
Follow conventional commits:
- `feat:` New feature
- `fix:` Bug fix
- `docs:` Documentation only
+2 -1
View File
@@ -13,7 +13,8 @@ and this project adheres to
### Added
- Comprehensive linting and formatting setup with ESLint and Prettier
- Configuration files organized in `.config/` folder for better project structure
- Configuration files organized in `.config/` folder for better project
structure
- GitHub Action workflow for automated lint checks on pull requests
- Package manager specification for consistent dependency management