Skip to content

feat: import skills from url - #107

Merged
ymkiux merged 1 commit into
mainfrom
pr-107-import-skills-url
Apr 26, 2026
Merged

feat: import skills from url#107
ymkiux merged 1 commit into
mainfrom
pr-107-import-skills-url

Conversation

@ymkiux

@ymkiux ymkiux commented Apr 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add import-skills command to download a skills zip from URL and import it

Tests

  • npm test

Summary by CodeRabbit

  • New Features

    • Added a new CLI command to import skills from a remote ZIP URL.
    • GitHub repository URLs are automatically converted to downloadable archive format.
    • Includes timeout and file size limits for secure downloads.
  • Tests

    • Added unit test coverage for URL handling and conversion.

@coderabbitai

coderabbitai Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 11357053-09f9-41ca-b25e-1a5169bb660d

📥 Commits

Reviewing files that changed from the base of the PR and between aff604b and 5725f54.

📒 Files selected for processing (3)
  • cli.js
  • cli/import-skills-url.js
  • tests/unit/import-skills-url.test.mjs

📝 Walkthrough

Walkthrough

A new CLI subcommand import-skills enables importing skills from remote ZIP URLs, with automatic GitHub repository URL transformation. The feature includes argument parsing, validation, streaming download with error handling, and integration with existing skill import functionality, along with unit tests for URL resolution logic.

Changes

Cohort / File(s) Summary
CLI Command Integration
cli.js
Wires new cmdImportSkills() subcommand into CLI dispatcher; catches execution errors, logs them with fallback e.message, and sets exit code 1 on failure.
URL Import Handler
cli/import-skills-url.js
Implements CLI command module for importing skills from URLs. Parses --targetApp, --name, --timeoutMs flags; transforms GitHub repository URLs (e.g., github.com/<owner>/<repo>/tree/<ref>) into direct archive URLs; downloads ZIP via streaming HTTP(S) GET with redirect and timeout limits; validates URL scheme and file size; calls importSkillsFromZipFile() and outputs resulting JSON.
Unit Tests
tests/unit/import-skills-url.test.mjs
Tests resolveGithubArchiveZipUrl() function with various GitHub URL formats (plain repo, trailing slash, .git suffix, /tree/<branch>) and verifies correct archive URL transformation; includes tests for non-GitHub and invalid URLs.

Sequence Diagram

sequenceDiagram
    actor User as CLI User
    participant cli.js
    participant cmdImportSkills as CLI Command Handler
    participant urlHandler as URL Resolver
    participant fs as File System
    participant http as HTTP Client
    participant importFunc as importSkillsFromZipFile()
    
    User->>cli.js: $ cli import-skills --url <url>
    cli.js->>cmdImportSkills: cmdImportSkills(argv)
    cmdImportSkills->>urlHandler: Parse & validate arguments
    alt GitHub URL detected
        urlHandler->>urlHandler: Transform to archive URL
    end
    cmdImportSkills->>fs: Create temp directory
    cmdImportSkills->>http: Stream download ZIP
    http-->>fs: Write skills.zip
    cmdImportSkills->>importFunc: importSkillsFromZipFile(tempDir, ...)
    importFunc-->>cmdImportSkills: Return skill data (JSON)
    cmdImportSkills->>User: Output JSON to stdout
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A new skill comes hopping to town,
From GitHub repos and ZIP files profound!
With URLs parsed and archives unzipped,
The rabbit's import tools firmly equipped—
No skill shall remain locked away! 🎉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pr-107-import-skills-url

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ymkiux
ymkiux merged commit 816ef6c into main Apr 26, 2026
6 of 7 checks passed
@ymkiux
ymkiux deleted the pr-107-import-skills-url branch April 26, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant