commit dd33dbba5526a5ed2f8b7908ae879045c797f6b3 Author: Zhongwei Li Date: Sun Nov 30 08:45:21 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..ff6f531 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "git-lines", + "description": "Line-level git staging for LLMs and automation", + "version": "0.2.0", + "author": { + "name": "Omegaice", + "url": "https://github.com/Omegaice" + }, + "skills": [ + "./skills" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..fa7cb7f --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# git-lines + +Line-level git staging for LLMs and automation diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..1d9d505 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,45 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:Omegaice/git-lines:", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "0634e456e48357017e7843044c4defcffd897806", + "treeHash": "8059d230f49d373452e2d536c5d0d319f9f88f7dca53fd3db41622ddf2fd021a", + "generatedAt": "2025-11-28T10:12:19.214921Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "git-lines", + "description": "Line-level git staging for LLMs and automation", + "version": "0.2.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "d52a02d254d1d4231bf7b161f3c13cbce49bbb27228c92913ce59181b5fce661" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "fefb0a1018c0258efc992b5f16bcbca0269f51223ffa4ca5dd2dd0dd0e947733" + }, + { + "path": "skills/git-lines/SKILL.md", + "sha256": "484461677e18bc18abf5d10d9e37f45e73040418805812524cedf50430b5d2e8" + } + ], + "dirSha256": "8059d230f49d373452e2d536c5d0d319f9f88f7dca53fd3db41622ddf2fd021a" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/git-lines/SKILL.md b/skills/git-lines/SKILL.md new file mode 100644 index 0000000..a24c1d4 --- /dev/null +++ b/skills/git-lines/SKILL.md @@ -0,0 +1,73 @@ +--- +name: git-lines +description: Stages specific lines from git diffs when hunk-level staging is too coarse. Use when a file contains multiple unrelated changes that need separate semantic commits, split commits, partial staging, or cherry-picking specific lines. Requires git-lines tool on PATH. +--- + +# Line-Level Git Staging + +## Requirements + +The `git-lines` tool must be installed and on PATH: +```bash +git-lines --version # verify installation +``` + +> **Important**: Use normal git for viewing changes, staging whole files, and committing. Only use git-lines for the specific task of staging individual lines. + +## Workflow + +``` +git diff # review changes (normal git) +↓ decide: "need to split this file" +git lines diff config.rs # get line numbers +git lines stage config.rs:10 # stage first change +git commit -m "feat: first change" +git lines stage config.rs:25 # stage second change +git commit -m "fix: second change" +``` + +## Commands + +Can be invoked as `git-lines` or `git lines` (if on PATH). + +**View line numbers** (only when you intend to stage): +```bash +git lines diff # all changed files +git lines diff file.rs # specific file +``` + +Example output: +``` +file.rs: + +10: new_function(); + + -25: old_code(); + +26: replacement_code(); + + +40: another_addition(); +``` + +**Stage specific lines**: +```bash +git lines stage file.rs:10 # single addition +git lines stage file.rs:-25 # single deletion +git lines stage file.rs:-25,26 # replacement (delete old, add new) +git lines stage file.rs:10..20 # range of additions +git lines stage file.rs:10,15,-20 # multiple (mixed) +git lines stage a.rs:5 b.rs:10 # multiple files +git lines stage -q file.rs:10 # quiet mode (no output) +``` + +After staging, shows what was staged: +``` +Staged: +file.rs: + -25: old_code(); + +25: replacement_code(); +``` + +Use `--quiet` / `-q` to suppress this output. + +## Line Numbers Stay Stable + +Line numbers always refer to working tree positions, which don't change until you edit the file. You can run multiple `git lines stage` commands using line numbers from the same initial `git lines diff` output.