Files
skillshare/website/docs/commands/update.md
T
Willie 0162bddfde feat: add per-target sync mode support for project mode
Allow project targets to set mode individually (merge or symlink),
mirroring global behavior. Default remains merge.

- Add Mode field to ProjectTargetEntry with YAML marshal/unmarshal
- Add mode branching in project sync (reuses syncMergeMode/syncSymlinkMode)
- Support --mode flag in target info for project targets
- Mode-aware unlink in target remove
- Unify project sync UI with global sync output format
- Update docs to reflect per-target mode support
2026-02-05 13:20:12 +08:00

184 lines
8.1 KiB
Markdown

---
sidebar_position: 2
---
# update
Update a skill or tracked repository to the latest version.
```bash
skillshare update my-skill # Update single skill
skillshare update team-skills # Update tracked repo
skillshare update --all # Update everything
```
![update demo](/img/update-skilk-demo.png)
## What Happens
### For Tracked Repositories
```
┌─────────────────────────────────────────────────────────────────┐
│ skillshare update _team-skills │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 1. Check for uncommitted changes │
│ → "Repository has uncommitted changes" │
│ → Use --force to discard and update │
└─────────────────────────────────────────────────────────────────┘
│ (clean)
▼
┌─────────────────────────────────────────────────────────────────┐
│ 2. Run git pull │
│ → Fetching from origin... │
│ → 3 commits, 5 files changed │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 3. Show changes │
│ → abc1234 Add new feature │
│ → def5678 Fix bug in parser │
└─────────────────────────────────────────────────────────────────┘
```
### For Regular Skills
```
┌─────────────────────────────────────────────────────────────────┐
│ skillshare update my-skill │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 1. Read metadata │
│ → Source: github.com/user/skills │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ 2. Re-install from source │
│ → Cloning repository... │
│ → Updated my-skill │
└─────────────────────────────────────────────────────────────────┘
```
## Options
| Flag | Description |
|------|-------------|
| `--all, -a` | Update all tracked repos and skills with metadata |
| `--force, -f` | Discard local changes and force update |
| `--dry-run, -n` | Preview without making changes |
| `--help, -h` | Show help |
## Update All
Update everything at once:
```bash
skillshare update --all
```
This updates:
1. All tracked repositories (git pull)
2. All skills with source metadata (re-install)
### Example Output
```
┌─────────────────────────────────────────────────────────────────┐
│ skillshare update --all │
│ Updating 2 tracked repos + 3 skills │
└─────────────────────────────────────────────────────────────────┘
[1/5] ✓ _team-skills Already up to date
[2/5] ✓ _personal-repo 3 commits, 2 files
[3/5] ✓ my-skill Reinstalled from source
[4/5] ! other-skill has uncommitted changes (use --force)
[5/5] ✓ another-skill Reinstalled from source
┌────────────────────────────┐
│ Summary │
│ Total: 5 │
│ Updated: 4 │
│ Skipped: 1 │
└────────────────────────────┘
```
## Handling Conflicts
If a tracked repo has uncommitted changes:
```bash
# Option 1: Commit your changes first
cd ~/.config/skillshare/skills/_team-skills
git add . && git commit -m "My changes"
skillshare update _team-skills
# Option 2: Discard and force update
skillshare update _team-skills --force
```
## After Updating
Run `skillshare sync` to distribute changes to all targets:
```bash
skillshare update --all
skillshare sync
```
## Project Mode
Update skills and tracked repos in the project:
```bash
skillshare update pdf -p # Update single skill (reinstall)
skillshare update team-skills -p # Update tracked repo (git pull)
skillshare update --all -p # Update everything
skillshare update --all -p --dry-run # Preview
```
### How It Works
| Type | Method | Detected by |
|------|--------|-------------|
| **Tracked repo** (`_repo`) | `git pull` | Has `.git/` directory |
| **Remote skill** (with metadata) | Reinstall from source | Has `.skillshare-meta.json` |
| **Local skill** | Skipped | No metadata |
The `_` prefix is optional — `skillshare update team-skills -p` auto-detects `_team-skills`.
### Handling Conflicts
Tracked repos with uncommitted changes are blocked by default:
```bash
# Option 1: Commit changes first
cd .skillshare/skills/_team-skills
git add . && git commit -m "My changes"
skillshare update team-skills -p
# Option 2: Discard and force update
skillshare update team-skills -p --force
```
### Typical Workflow
```bash
skillshare update --all -p
skillshare sync
git add .skillshare/ && git commit -m "Update remote skills"
```
## Related
- [install](/docs/commands/install) — Install skills
- [upgrade](/docs/commands/upgrade) — Upgrade CLI and built-in skill
- [sync](/docs/commands/sync) — Sync to targets
- [Project Skills](/docs/concepts/project-skills) — Project mode concepts