mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-29 14:37:44 +02:00
Extends POST /api/skills/import to accept github.com URLs in three forms:
- github.com/{owner}/{repo} (root SKILL.md, default branch)
- github.com/{owner}/{repo}/tree/{ref}/{path} (skill subdirectory)
- github.com/{owner}/{repo}/blob/{ref}/{path}/SKILL.md
The new fetchFromGitHub helper reuses existing GitHub API helpers
(fetchGitHubDefaultBranch, collectGitHubFiles, etc.) and writes
provenance to skill.config.origin so list and detail UI can render
'Imported from GitHub' and link back to the source.
Hardening:
- fetchRawFile now returns an error when a single file exceeds the
per-file cap instead of silently truncating the body.
- Imported bundles are bounded by maxImportFileCount (128) and
maxImportTotalSize (8 MiB) via importedSkill.addFile.
- Origin metadata is now also written for ClawHub and Skills.sh
imports (previously left empty) so the UI is consistent.
Frontend:
- OriginInfo gains a 'github' variant; create dialog detects github.com
URLs and shows a dedicated source card; columns and detail view
render 'From GitHub' / 'Imported from GitHub'.
- en + zh-Hans translations for source_github, origin_github,
imported_github, importing_github.
CLI: 'multica skill import' short description now mentions github.com.
Tests:
- TestParseGitHubURL covers root, tree, blob (must end with SKILL.md),
URL-encoded path segments, and error paths.
- TestFetchFromGitHub_TreeURLImportsSkillDirectory verifies supporting
files have the in-repo prefix stripped (skillDir-relative paths).
- TestFetchFromGitHub_RepoRootResolvesDefaultBranch and
TestFetchFromGitHub_RepoRootMissingSKILLmdReturnsActionableError.
- TestFetchFromGitHub_BlobURLImportsSpecificSkill.
- TestFetchRawFile_ReturnsErrorOnOversizedFile and
TestImportedSkill_AddFileEnforcesBundleLimits.
- TestDetectImportSource_RecognizesGitHub.
Closes MUL-1522.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: multica-agent <github@multica.ai>