Rename ref to version
Assisted-by: Claude Opus 4.6 via pi
change rlovynnrplwptwpyuyvksqzmwuqnwnrt
commit 3f0d183ee5e573f8ea67c856d586e7510b2a5a58
author Alpha Chen <alpha@kejadlen.dev>
date
parent znrppnmk
diff --git a/README.md b/README.md
index 41afd66..1054b90 100644
--- a/README.md
+++ b/README.md
@@ -45,24 +45,24 @@ alphabetically. Duplicate skill names across files are a hard error.
 marketplaces:
   my-skills:
     src: https://github.com/user/skills-repo
-    ref: main                 # default ref for plugins from this marketplace
+    version: main                 # default version (branch/tag) for plugins from this marketplace
     manifest: custom/path/marketplace.json  # optional, defaults to .claude-plugin/marketplace.json
 
 plugins:
   jj:
-    marketplace: my-skills    # inherits src, ref, and manifest from the marketplace
+    marketplace: my-skills    # inherits src, version, and manifest from the marketplace
 
   gh-pr:
     marketplace: my-skills
-    ref: v1.2.0               # override the marketplace default ref
+    version: v1.2.0               # override the marketplace default
 
   one-off-skill:
     src: https://github.com/other/repo   # standalone plugin, no marketplace
-    ref: main
+    version: main
 ```
 
-Plugins can reference a named marketplace (inheriting `src` and `ref`) or
-specify `src`/`ref` directly. The plugin path within the repo is discovered
+Plugins can reference a named marketplace (inheriting `src` and `version`) or
+specify `src`/`version` directly. The plugin path within the repo is discovered
 from `.claude-plugin/marketplace.json` (or the marketplace's `manifest` override).
 
 Removing a skill is done by removing it from the config and re-running
@@ -109,7 +109,7 @@ Optional: `pinch install --update` — runs update then install in one shot.
 Reads the **config** (merged conf.d). For each skill:
 
 1. Fetches the repo.
-2. Resolves the `ref` (branch/tag) to a commit SHA.
+2. Resolves the `version` (branch/tag) to a commit SHA.
 3. Writes the lockfile.
 
 Does **not** touch symlinks or `~/.claude/skills/`.
diff --git a/src/config.rs b/src/config.rs
index ca2c9b6..3cd8625 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -8,7 +8,7 @@ use serde::Deserialize;
 pub struct Plugin {
     pub name: String,
     pub src: String,
-    pub r#ref: String,
+    pub version: String,
     /// Path to marketplace.json within the repo.
     /// Defaults to `.claude-plugin/marketplace.json`.
     pub marketplace: Option<String>,
@@ -77,7 +77,7 @@ pub fn load() -> Result<Vec<Plugin>> {
                 );
             }
 
-            let (src, r#ref, marketplace_path) = match entry.marketplace {
+            let (src, version, marketplace_path) = match entry.marketplace {
                 Some(mkt_name) => {
                     let mkt = marketplaces.get(&mkt_name).ok_or_else(|| {
                         color_eyre::eyre::eyre!(
@@ -88,7 +88,7 @@ pub fn load() -> Result<Vec<Plugin>> {
                     })?;
                     (
                         mkt.src.clone(),
-                        entry.r#ref.unwrap_or_else(|| mkt.r#ref.clone()),
+                        entry.version.unwrap_or_else(|| mkt.version.clone()),
                         mkt.manifest.clone(),
                     )
                 }
@@ -99,17 +99,17 @@ pub fn load() -> Result<Vec<Plugin>> {
                             name
                         )
                     })?;
-                    let r#ref = entry.r#ref.ok_or_else(|| {
-                        color_eyre::eyre::eyre!("plugin '{}': 'ref' is required", name)
+                    let version = entry.version.ok_or_else(|| {
+                        color_eyre::eyre::eyre!("plugin '{}': 'version' is required", name)
                     })?;
-                    (src, r#ref, None)
+                    (src, version, None)
                 }
             };
 
             plugins.push(Plugin {
                 name,
                 src,
-                r#ref,
+                version,
                 marketplace: marketplace_path,
             });
         }
@@ -121,7 +121,7 @@ pub fn load() -> Result<Vec<Plugin>> {
 #[derive(Deserialize)]
 struct MarketplaceEntry {
     src: String,
-    r#ref: String,
+    version: String,
     /// Override path to marketplace.json within the repo.
     manifest: Option<String>,
 }
@@ -130,8 +130,8 @@ struct MarketplaceEntry {
 struct PluginEntry {
     /// Git repo URL. Required if no marketplace.
     src: Option<String>,
-    /// Git ref. Required if no marketplace (optional override with marketplace).
-    r#ref: Option<String>,
+    /// Git version (branch/tag). Required if no marketplace (optional override with marketplace).
+    version: Option<String>,
     /// Name of a marketplace defined in the config.
     marketplace: Option<String>,
 }
diff --git a/src/main.rs b/src/main.rs
index d6c57b6..17e19f5 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -102,8 +102,8 @@ fn do_update(names: &[String]) -> Result<()> {
         info!("updating {}...", plugin.name);
         let repo_path = git::repo_path(&repos_dir, &plugin.src);
         git::clone_or_fetch(&repo_path, &plugin.src)?;
-        let rev = git::resolve_ref(&repo_path, &plugin.r#ref)?;
-        info!("  {} -> {}", plugin.r#ref, &rev[..12]);
+        let rev = git::resolve_ref(&repo_path, &plugin.version)?;
+        info!("  {} -> {}", plugin.version, &rev[..12]);
 
         // Checkout to read marketplace.json and discover skill path
         git::checkout(&repo_path, &rev)?;