diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index fe59b53..0a3cf10 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -61,8 +61,10 @@ jobs: tar czf "${{ matrix.archive }}" "${{ matrix.binary }}" fi - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.archive }} - path: target/${{ matrix.target }}/release/${{ matrix.archive }} + - name: Upload to release + run: | + curl --fail -X POST \ + -H "Authorization: Bearer ${{ secrets.GITEA_TOKEN }}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @"target/${{ matrix.target }}/release/${{ matrix.archive }}" \ + "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=${{ matrix.archive }}" diff --git a/src/marketplace.rs b/src/marketplace.rs index 8c6bd88..b4cab3e 100644 --- a/src/marketplace.rs +++ b/src/marketplace.rs @@ -19,6 +19,8 @@ pub struct SkillEntry { pub repository: String, #[serde(default)] pub branch: Option, + #[serde(default)] + pub path: Option, } pub fn add(url: &str, name: Option<&str>) -> Result { diff --git a/src/skill.rs b/src/skill.rs index c234a1b..0d687eb 100644 --- a/src/skill.rs +++ b/src/skill.rs @@ -38,10 +38,20 @@ pub fn install( let branch = entry.branch.as_deref().unwrap_or("main"); download::download_skill(&entry.repository, branch, &target)?; - // Deploy to Claude skills directory (copy or link) + let deploy_source = match &entry.path { + Some(subdir) => { + let p = target.join(subdir); + if !p.exists() { + return Err(format!("Path '{}' not found in skill repository", subdir)); + } + p + } + None => target.clone(), + }; + let config = Config::load().map_err(|e| format!("Cannot read config: {e}"))?; let deploy_mode = mode.unwrap_or_else(|| config.default_mode.clone()); - deploy_skill(name, &target, &deploy_mode)?; + deploy_skill(name, &deploy_source, &deploy_mode)?; Ok(Skill { name: name.to_string(), @@ -233,12 +243,16 @@ pub fn update(name: Option<&str>) -> Result, String> { match download::download_skill(&skill_entry.repository, branch, &old_path) { Ok(()) => { + let deploy_source = match &skill_entry.path { + Some(subdir) => old_path.join(subdir), + None => old_path.clone(), + }; // Redeploy if previously deployed if deploy_mode.is_some() || config.default_mode != InstallMode::Copy { let mode = deploy_mode .clone() .unwrap_or_else(|| config.default_mode.clone()); - match deploy_skill(skill_name, &old_path, &mode) { + match deploy_skill(skill_name, &deploy_source, &mode) { Ok(()) => results.push((skill_name.clone(), "Updated".to_string())), Err(e) => results.push((skill_name.clone(), format!("Downloaded but deploy failed: {e}"))), }