repo-do 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -35
- package/docs/README.zh-CN.md +403 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A unified CLI tool for managing git repositories with a structured directory lay
|
|
|
6
6
|
Organize all your repositories in a consistent domain-based structure.
|
|
7
7
|
Fast search, clipboard integration, and cross-platform support.
|
|
8
8
|
|
|
9
|
-
English · [简体中文](
|
|
9
|
+
English · [简体中文](https://github.com/STDSuperman/node-utils/blob/master/packages/repo-do/docs/README.zh-CN.md)
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/repo-do)
|
|
12
12
|
[](https://github.com/STDSuperman/repo-do/blob/master/LICENSE)
|
|
@@ -36,14 +36,14 @@ English · [简体中文](./docs/README.zh-CN.md)
|
|
|
36
36
|
npm install -g repo-do
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
> **
|
|
39
|
+
> **Command aliases**: `rpd` and `repo-do` are equivalent. The examples below prefer the shorter `rpd` alias.
|
|
40
40
|
|
|
41
41
|
## Quick Start
|
|
42
42
|
|
|
43
43
|
### 1. Initialize Configuration
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
|
|
46
|
+
rpd init
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
This prompts you to set a base directory for storing repositories (default: `~/.repo-do/repo`).
|
|
@@ -51,7 +51,7 @@ This prompts you to set a base directory for storing repositories (default: `~/.
|
|
|
51
51
|
### 2. Clone a Repository
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
|
|
54
|
+
rpd add git@github.com:STDSuperman/super-image-cropper.git
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
The repository will be cloned to:
|
|
@@ -64,7 +64,7 @@ The `cd` command is automatically copied to your clipboard!
|
|
|
64
64
|
### 3. Find a Repository
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
|
-
|
|
67
|
+
rpd find super-image
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
Output:
|
|
@@ -76,7 +76,7 @@ Found 1 repository:
|
|
|
76
76
|
### 4. List All Repositories
|
|
77
77
|
|
|
78
78
|
```bash
|
|
79
|
-
|
|
79
|
+
rpd list
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
Output:
|
|
@@ -90,15 +90,15 @@ Total: 3 repositories
|
|
|
90
90
|
|
|
91
91
|
## Commands
|
|
92
92
|
|
|
93
|
-
### `repo-do init`
|
|
93
|
+
### `rpd init` / `repo-do init`
|
|
94
94
|
|
|
95
95
|
Initialize configuration and set the base directory for repositories.
|
|
96
96
|
|
|
97
97
|
```bash
|
|
98
|
-
|
|
98
|
+
rpd init
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
### `repo-do add <repo_url> [git-clone-args...]`
|
|
101
|
+
### `rpd add <repo_url> [git-clone-args...]` / `repo-do add <repo_url> [git-clone-args...]`
|
|
102
102
|
|
|
103
103
|
Clone a repository to the structured directory.
|
|
104
104
|
|
|
@@ -110,25 +110,25 @@ Clone a repository to the structured directory.
|
|
|
110
110
|
|
|
111
111
|
```bash
|
|
112
112
|
# Basic clone
|
|
113
|
-
|
|
113
|
+
rpd add git@github.com:STDSuperman/super-image-cropper.git
|
|
114
114
|
|
|
115
115
|
# Shallow clone
|
|
116
|
-
|
|
116
|
+
rpd add https://github.com/STDSuperman/super-image-cropper.git --depth 1
|
|
117
117
|
|
|
118
118
|
# Clone specific branch
|
|
119
|
-
|
|
119
|
+
rpd add https://github.com/STDSuperman/super-image-cropper.git --branch develop
|
|
120
120
|
|
|
121
121
|
# SSH clone
|
|
122
|
-
|
|
122
|
+
rpd add git@github.com:STDSuperman/NanoBanana-PPT-Skills.git
|
|
123
123
|
|
|
124
124
|
# JSON output (for scripts and AI models)
|
|
125
|
-
|
|
125
|
+
rpd add https://github.com/user/repo.git --json
|
|
126
126
|
|
|
127
127
|
# Force a new clone even if the same remote is already tracked
|
|
128
|
-
|
|
128
|
+
rpd add https://github.com/user/repo.git --force-clone
|
|
129
129
|
|
|
130
130
|
# Use an already tracked local repository without prompting
|
|
131
|
-
|
|
131
|
+
rpd add https://github.com/user/repo.git --use-existing
|
|
132
132
|
```
|
|
133
133
|
|
|
134
134
|
Before cloning, `repo-do` checks the global repository configuration for the same remote repository. SSH and HTTPS remotes such as `git@github.com:user/repo.git` and `https://github.com/user/repo` are treated as the same repository. If a matching repository already exists in another local directory, interactive mode asks whether to use the existing directory. `--json` mode uses the existing directory automatically unless `--force-clone` is provided.
|
|
@@ -166,14 +166,14 @@ On failure, the process exits with code 1 and outputs:
|
|
|
166
166
|
└── internal-tool/
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
-
### `repo-do find <query>`
|
|
169
|
+
### `rpd find <query>` / `repo-do find <query>`
|
|
170
170
|
|
|
171
171
|
Search for repositories by name, group, or path fragment (case-insensitive).
|
|
172
172
|
|
|
173
173
|
```bash
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
rpd find super-image
|
|
175
|
+
rpd find STDSuperman
|
|
176
|
+
rpd find github.com
|
|
177
177
|
```
|
|
178
178
|
|
|
179
179
|
**Output format:**
|
|
@@ -185,57 +185,57 @@ Found 2 repositories:
|
|
|
185
185
|
|
|
186
186
|
Each result is prefixed with a number, followed by the absolute path.
|
|
187
187
|
|
|
188
|
-
### `repo-do list [--refresh]`
|
|
188
|
+
### `rpd list [--refresh]` / `repo-do list [--refresh]`
|
|
189
189
|
|
|
190
190
|
List all managed repositories.
|
|
191
191
|
|
|
192
192
|
```bash
|
|
193
193
|
# List from cache (fast)
|
|
194
|
-
|
|
194
|
+
rpd list
|
|
195
195
|
|
|
196
196
|
# Force rebuild cache
|
|
197
|
-
|
|
197
|
+
rpd list --refresh
|
|
198
198
|
```
|
|
199
199
|
|
|
200
200
|
When `--refresh` is used, `repo-do` scans the configured base directory, records detected Git repositories in configuration, and rebuilds the fast repository cache.
|
|
201
201
|
|
|
202
|
-
### `repo-do scan [paths...]`
|
|
202
|
+
### `rpd scan [paths...]` / `repo-do scan [paths...]`
|
|
203
203
|
|
|
204
204
|
Scan existing Git repositories and track them in configuration.
|
|
205
205
|
|
|
206
206
|
```bash
|
|
207
207
|
# Scan the configured base directory
|
|
208
|
-
|
|
208
|
+
rpd scan
|
|
209
209
|
|
|
210
210
|
# Scan one or more custom directories
|
|
211
|
-
|
|
211
|
+
rpd scan ~/Code ~/work
|
|
212
212
|
```
|
|
213
213
|
|
|
214
214
|
Detected repositories are grouped by normalized remote URL. If the same remote exists in multiple local directories, all directories are stored as locations for that repository.
|
|
215
215
|
|
|
216
|
-
### `repo-do remove <repo>`
|
|
216
|
+
### `rpd remove <repo>` / `repo-do remove <repo>`
|
|
217
217
|
|
|
218
218
|
Remove a repository from tracking (does not delete files).
|
|
219
219
|
|
|
220
220
|
```bash
|
|
221
|
-
|
|
221
|
+
rpd remove super-image
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
If multiple matches are found, you'll be prompted to select which one to remove.
|
|
225
225
|
|
|
226
|
-
### `repo-do config [options]`
|
|
226
|
+
### `rpd config [options]` / `repo-do config [options]`
|
|
227
227
|
|
|
228
228
|
View or modify configuration.
|
|
229
229
|
|
|
230
230
|
```bash
|
|
231
231
|
# Show current config
|
|
232
|
-
|
|
232
|
+
rpd config
|
|
233
233
|
|
|
234
234
|
# Get base directory
|
|
235
|
-
|
|
235
|
+
rpd config --get baseDirectory
|
|
236
236
|
|
|
237
237
|
# Set base directory
|
|
238
|
-
|
|
238
|
+
rpd config --set baseDirectory /path/to/repos
|
|
239
239
|
```
|
|
240
240
|
|
|
241
241
|
## Directory Structure
|
|
@@ -291,9 +291,9 @@ Configuration is stored in `~/.repo-do/config.json`:
|
|
|
291
291
|
To improve performance, `repo-do` maintains a repository cache at `~/.repo-do/repo_cache.json`.
|
|
292
292
|
|
|
293
293
|
**Cache is automatically updated when:**
|
|
294
|
-
- Adding a new repository (`repo-do add`)
|
|
295
|
-
- Removing a repository (`repo-do remove`)
|
|
296
|
-
- Forcing refresh (`repo-do list --refresh`)
|
|
294
|
+
- Adding a new repository (`rpd add` / `repo-do add`)
|
|
295
|
+
- Removing a repository (`rpd remove` / `repo-do remove`)
|
|
296
|
+
- Forcing refresh (`rpd list --refresh` / `repo-do list --refresh`)
|
|
297
297
|
|
|
298
298
|
**Cache format:**
|
|
299
299
|
```json
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# repo-do
|
|
4
|
+
|
|
5
|
+
一个用于统一管理 Git 仓库的 CLI 工具,提供结构化的目录布局。
|
|
6
|
+
以一致的、基于域名的结构组织你的所有仓库。
|
|
7
|
+
快速搜索、剪贴板集成、跨平台支持。
|
|
8
|
+
|
|
9
|
+
[English](https://github.com/STDSuperman/node-utils/blob/master/packages/repo-do/README.md) · 简体中文
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/repo-do)
|
|
12
|
+
[](https://github.com/STDSuperman/repo-do/blob/master/LICENSE)
|
|
13
|
+
[](https://nodejs.org)
|
|
14
|
+
[](https://www.npmjs.com/package/repo-do)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
## 概述
|
|
19
|
+
|
|
20
|
+
`repo-do` 帮助你以统一的、基于域名的目录结构组织所有 Git 仓库。它会自动将仓库克隆到规范的路径下,并提供快速搜索功能,让你轻松查找和访问项目。
|
|
21
|
+
|
|
22
|
+
## 特性
|
|
23
|
+
|
|
24
|
+
- **结构化组织**:按 `{baseDir}/{domain}/{group}/{repo}` 结构克隆仓库
|
|
25
|
+
- **快速仓库搜索**:通过名称或路径片段快速查找仓库
|
|
26
|
+
- **剪贴板集成**:自动复制 `cd` 命令到剪贴板
|
|
27
|
+
- **缓存性能优化**:快速列出仓库,无需重复扫描目录
|
|
28
|
+
- **跨平台支持**:支持 Windows、macOS 和 Linux
|
|
29
|
+
- **Git 参数透传**:支持所有 git clone 参数(--depth、--branch 等)
|
|
30
|
+
|
|
31
|
+
## 安装
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install -g repo-do
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> **命令别名**:`rpd` 和 `repo-do` 等价。下面的示例优先使用更短的 `rpd`。
|
|
38
|
+
|
|
39
|
+
## 快速开始
|
|
40
|
+
|
|
41
|
+
### 1. 初始化配置
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
rpd init
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
这将提示你设置存储仓库的基础目录(默认:`~/.repo-do/repo`)。
|
|
48
|
+
|
|
49
|
+
### 2. 克隆仓库
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
rpd add git@github.com:STDSuperman/super-image-cropper.git
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
仓库将被克隆到:
|
|
56
|
+
```
|
|
57
|
+
{baseDir}/github.com/STDSuperman/super-image-cropper
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`cd` 命令会自动复制到剪贴板!
|
|
61
|
+
|
|
62
|
+
### 3. 查找仓库
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
rpd find super-image
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
输出:
|
|
69
|
+
```
|
|
70
|
+
找到 1 个仓库:
|
|
71
|
+
1. D:\Code\github.com\STDSuperman\super-image-cropper
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 4. 列出所有仓库
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
rpd list
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
输出:
|
|
81
|
+
```
|
|
82
|
+
github.com/STDSuperman/super-image-cropper
|
|
83
|
+
github.com/STDSuperman/NanoBanana-PPT-Skills
|
|
84
|
+
gitlab.com/myorg/internal-tool
|
|
85
|
+
|
|
86
|
+
总计: 3 个仓库
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 命令
|
|
90
|
+
|
|
91
|
+
### `rpd init` / `repo-do init`
|
|
92
|
+
|
|
93
|
+
初始化配置并设置仓库的基础目录。
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
rpd init
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `rpd add <repo_url> [git-clone-args...]` / `repo-do add <repo_url> [git-clone-args...]`
|
|
100
|
+
|
|
101
|
+
克隆仓库到结构化目录。
|
|
102
|
+
|
|
103
|
+
**支持的 URL 格式:**
|
|
104
|
+
- HTTPS:`https://github.com/user/repo.git` 或 `https://github.com/user/repo`
|
|
105
|
+
- SSH:`git@github.com:user/repo.git` 或 `ssh://git@github.com/user/repo.git`
|
|
106
|
+
|
|
107
|
+
**示例:**
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# 基础克隆
|
|
111
|
+
rpd add git@github.com:STDSuperman/super-image-cropper.git
|
|
112
|
+
|
|
113
|
+
# 浅克隆
|
|
114
|
+
rpd add https://github.com/STDSuperman/super-image-cropper.git --depth 1
|
|
115
|
+
|
|
116
|
+
# 克隆指定分支
|
|
117
|
+
rpd add https://github.com/STDSuperman/super-image-cropper.git --branch develop
|
|
118
|
+
|
|
119
|
+
# SSH 克隆
|
|
120
|
+
rpd add git@github.com:STDSuperman/NanoBanana-PPT-Skills.git
|
|
121
|
+
|
|
122
|
+
# JSON 输出(供脚本和 AI 模型使用)
|
|
123
|
+
rpd add https://github.com/user/repo.git --json
|
|
124
|
+
|
|
125
|
+
# 即使同一个远端仓库已被记录,也强制克隆一份新的
|
|
126
|
+
rpd add https://github.com/user/repo.git --force-clone
|
|
127
|
+
|
|
128
|
+
# 不询问,直接采用已记录的本地仓库
|
|
129
|
+
rpd add https://github.com/user/repo.git --use-existing
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
克隆前,`repo-do` 会先查询全局仓库配置。`git@github.com:user/repo.git` 和 `https://github.com/user/repo` 这类 SSH/HTTPS 地址会被识别为同一个远端仓库。如果同一个远端已经存在于其他本地目录,交互模式会询问是否直接采用已有目录;`--json` 模式默认直接采用已有目录,除非传入 `--force-clone`。
|
|
133
|
+
|
|
134
|
+
**`--json` 输出:**
|
|
135
|
+
|
|
136
|
+
使用 `--json` 时,命令仅在 stdout 输出一行 JSON,不会有 spinner、颜色或剪贴板操作:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{"success":true,"path":"/path/to/repo","alreadyExists":false,"message":""}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
| 字段 | 类型 | 说明 |
|
|
143
|
+
|------|------|------|
|
|
144
|
+
| `success` | boolean | `true` 表示仓库路径可用(已克隆或已存在) |
|
|
145
|
+
| `path` | string | 本地仓库的绝对路径 |
|
|
146
|
+
| `alreadyExists` | boolean | `true` 表示仓库此前已克隆过 |
|
|
147
|
+
| `adoptedExisting` | boolean | `true` 表示采用了其他目录里的已有仓库 |
|
|
148
|
+
| `message` | string | 错误或状态信息 |
|
|
149
|
+
|
|
150
|
+
失败时进程以 exit code 1 退出,输出:
|
|
151
|
+
```json
|
|
152
|
+
{"success":false,"path":"","alreadyExists":false,"message":"错误详情"}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**目录结构:**
|
|
156
|
+
```
|
|
157
|
+
{baseDir}/
|
|
158
|
+
├── github.com/
|
|
159
|
+
│ └── STDSuperman/
|
|
160
|
+
│ ├── super-image-cropper/
|
|
161
|
+
│ └── NanoBanana-PPT-Skills/
|
|
162
|
+
└── gitlab.com/
|
|
163
|
+
└── myorg/
|
|
164
|
+
└── internal-tool/
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### `rpd find <query>` / `repo-do find <query>`
|
|
168
|
+
|
|
169
|
+
通过名称、组织或路径片段搜索仓库(不区分大小写)。
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
rpd find super-image
|
|
173
|
+
rpd find STDSuperman
|
|
174
|
+
rpd find github.com
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**输出格式:**
|
|
178
|
+
```
|
|
179
|
+
找到 2 个仓库:
|
|
180
|
+
1. D:\Code\github.com\STDSuperman\super-image-cropper
|
|
181
|
+
2. D:\Code\github.com\STDSuperman\NanoBanana-PPT-Skills
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
每个结果前都有序号,后面是仓库的绝对路径。
|
|
185
|
+
|
|
186
|
+
### `rpd list [--refresh]` / `repo-do list [--refresh]`
|
|
187
|
+
|
|
188
|
+
列出所有管理的仓库。
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# 从缓存列出(快速)
|
|
192
|
+
rpd list
|
|
193
|
+
|
|
194
|
+
# 强制重建缓存
|
|
195
|
+
rpd list --refresh
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
使用 `--refresh` 时,`repo-do` 会扫描已配置的基础目录,将检测到的 Git 仓库写入配置,并重建快速缓存。
|
|
199
|
+
|
|
200
|
+
### `rpd scan [paths...]` / `repo-do scan [paths...]`
|
|
201
|
+
|
|
202
|
+
扫描已有 Git 仓库并写入配置。
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# 扫描配置里的基础目录
|
|
206
|
+
rpd scan
|
|
207
|
+
|
|
208
|
+
# 扫描一个或多个自定义目录
|
|
209
|
+
rpd scan ~/Code ~/work
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
扫描到的仓库会按规范化后的远端地址归档。如果同一个远端仓库存在多份本地目录,这些目录会作为同一个仓库的多个 location 维护。
|
|
213
|
+
|
|
214
|
+
### `rpd remove <repo>` / `repo-do remove <repo>`
|
|
215
|
+
|
|
216
|
+
从追踪中移除仓库(不会删除文件)。
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
rpd remove super-image
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
如果找到多个匹配项,会提示你选择要移除的仓库。
|
|
223
|
+
|
|
224
|
+
### `rpd config [options]` / `repo-do config [options]`
|
|
225
|
+
|
|
226
|
+
查看或修改配置。
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# 显示当前配置
|
|
230
|
+
rpd config
|
|
231
|
+
|
|
232
|
+
# 获取基础目录
|
|
233
|
+
rpd config --get baseDirectory
|
|
234
|
+
|
|
235
|
+
# 设置基础目录
|
|
236
|
+
rpd config --set baseDirectory /path/to/repos
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## 目录结构
|
|
240
|
+
|
|
241
|
+
所有仓库都按统一结构组织:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
{baseDirectory}/{domain}/{group}/{repository}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**示例:**
|
|
248
|
+
|
|
249
|
+
| Git URL | 克隆路径 |
|
|
250
|
+
|---------|---------|
|
|
251
|
+
| `git@github.com:STDSuperman/super-image-cropper.git` | `{baseDir}/github.com/STDSuperman/super-image-cropper` |
|
|
252
|
+
| `git@gitlab.com:myorg/myrepo.git` | `{baseDir}/gitlab.com/myorg/myrepo` |
|
|
253
|
+
| `https://github.com/STDSuperman/NanoBanana-PPT-Skills.git` | `{baseDir}/github.com/STDSuperman/NanoBanana-PPT-Skills` |
|
|
254
|
+
|
|
255
|
+
## 配置
|
|
256
|
+
|
|
257
|
+
配置存储在 `~/.repo-do/config.json`:
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"baseDirectory": "D:\\Code",
|
|
262
|
+
"version": "1.0.0",
|
|
263
|
+
"repositories": [
|
|
264
|
+
{
|
|
265
|
+
"id": "github.com/STDSuperman/super-image-cropper",
|
|
266
|
+
"canonicalRemote": "github.com/STDSuperman/super-image-cropper",
|
|
267
|
+
"displayUrl": "git@github.com:STDSuperman/super-image-cropper.git",
|
|
268
|
+
"domain": "github.com",
|
|
269
|
+
"group": "STDSuperman",
|
|
270
|
+
"name": "super-image-cropper",
|
|
271
|
+
"preferredPath": "D:\\Code\\github.com\\STDSuperman\\super-image-cropper",
|
|
272
|
+
"locations": [
|
|
273
|
+
{
|
|
274
|
+
"path": "D:\\Code\\github.com\\STDSuperman\\super-image-cropper",
|
|
275
|
+
"remoteUrl": "git@github.com:STDSuperman/super-image-cropper.git",
|
|
276
|
+
"remoteName": "origin",
|
|
277
|
+
"source": "clone",
|
|
278
|
+
"firstSeenAt": "2026-01-11T12:00:00.000Z",
|
|
279
|
+
"lastSeenAt": "2026-01-11T12:00:00.000Z"
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## 缓存系统
|
|
288
|
+
|
|
289
|
+
为了提高性能,`repo-do` 在 `~/.repo-do/repo_cache.json` 维护了一个仓库缓存。
|
|
290
|
+
|
|
291
|
+
**缓存会在以下情况自动更新:**
|
|
292
|
+
- 添加新仓库(`rpd add` / `repo-do add`)
|
|
293
|
+
- 移除仓库(`rpd remove` / `repo-do remove`)
|
|
294
|
+
- 强制刷新(`rpd list --refresh` / `repo-do list --refresh`)
|
|
295
|
+
|
|
296
|
+
**缓存格式:**
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"repositories": [
|
|
300
|
+
{
|
|
301
|
+
"name": "super-image-cropper",
|
|
302
|
+
"fullPath": "D:\\Code\\github.com\\STDSuperman\\super-image-cropper",
|
|
303
|
+
"gitUrl": "git@github.com:STDSuperman/super-image-cropper.git",
|
|
304
|
+
"domain": "github.com",
|
|
305
|
+
"group": "STDSuperman",
|
|
306
|
+
"lastUpdated": "2026-01-11T12:00:00.000Z"
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
"lastUpdated": "2026-01-11T12:00:00.000Z"
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## 跨平台支持
|
|
314
|
+
|
|
315
|
+
### 剪贴板支持
|
|
316
|
+
|
|
317
|
+
- **macOS**:使用 `pbcopy`
|
|
318
|
+
- **Linux**:使用 `xclip` 或 `xsel`(可能需要安装)
|
|
319
|
+
- **Windows**:使用 `clip` 命令
|
|
320
|
+
|
|
321
|
+
如果剪贴板操作失败,路径仍会显示在终端中。
|
|
322
|
+
|
|
323
|
+
### 路径处理
|
|
324
|
+
|
|
325
|
+
所有路径都使用 Node.js `path` 模块处理,确保跨平台兼容性。
|
|
326
|
+
|
|
327
|
+
## 系统要求
|
|
328
|
+
|
|
329
|
+
- Node.js >= 18.0.0
|
|
330
|
+
- 已安装 Git 并在 PATH 中可用
|
|
331
|
+
|
|
332
|
+
## 错误处理
|
|
333
|
+
|
|
334
|
+
`repo-do` 为常见问题提供清晰的错误消息:
|
|
335
|
+
|
|
336
|
+
- **INVALID_URL**:无法识别的 Git URL 格式
|
|
337
|
+
- **CLONE_FAILED**:Git 克隆操作失败
|
|
338
|
+
- **CONFIG_ERROR**:配置文件读写错误
|
|
339
|
+
- **NOT_FOUND**:在缓存中未找到仓库
|
|
340
|
+
- **PERMISSION_DENIED**:文件系统权限错误
|
|
341
|
+
- **GIT_NOT_INSTALLED**:未安装 Git
|
|
342
|
+
- **PATH_CONFLICT**:目标路径已存在,但不是请求的仓库
|
|
343
|
+
|
|
344
|
+
## 开发
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
# 克隆仓库
|
|
348
|
+
git clone https://github.com/your-username/repo-do.git
|
|
349
|
+
cd repo-do
|
|
350
|
+
|
|
351
|
+
# 安装依赖
|
|
352
|
+
npm install
|
|
353
|
+
|
|
354
|
+
# 开发模式运行
|
|
355
|
+
npm run dev
|
|
356
|
+
|
|
357
|
+
# 构建
|
|
358
|
+
npm run build
|
|
359
|
+
|
|
360
|
+
# 运行测试
|
|
361
|
+
npm test
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## 项目结构
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
repo-do/
|
|
368
|
+
├── src/
|
|
369
|
+
│ ├── commands/ # CLI 命令实现
|
|
370
|
+
│ ├── core/ # 核心业务逻辑
|
|
371
|
+
│ ├── utils/ # 工具函数
|
|
372
|
+
│ ├── types/ # TypeScript 类型定义
|
|
373
|
+
│ ├── constants/ # 常量
|
|
374
|
+
│ └── index.ts # CLI 入口
|
|
375
|
+
├── bin/
|
|
376
|
+
│ └── repo-do.js # 可执行文件入口
|
|
377
|
+
├── dist/ # 编译输出
|
|
378
|
+
└── tests/ # 测试文件
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
## 依赖说明
|
|
382
|
+
|
|
383
|
+
- **chalk**:终端文本样式
|
|
384
|
+
- **clipboardy**:跨平台剪贴板操作
|
|
385
|
+
- **commander**:CLI 框架
|
|
386
|
+
- **inquirer**:交互式命令行提示
|
|
387
|
+
- **ora**:优雅的终端 spinner
|
|
388
|
+
|
|
389
|
+
## 开源协议
|
|
390
|
+
|
|
391
|
+
MIT
|
|
392
|
+
|
|
393
|
+
## 贡献
|
|
394
|
+
|
|
395
|
+
欢迎贡献!请随时提交 Pull Request。
|
|
396
|
+
|
|
397
|
+
## 更新日志
|
|
398
|
+
|
|
399
|
+
### 1.0.0
|
|
400
|
+
- 初始版本发布
|
|
401
|
+
- 核心功能:init、add、list、find、remove、config
|
|
402
|
+
- 跨平台支持
|
|
403
|
+
- 缓存系统实现快速仓库列表
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repo-do",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Unified git repository management tool",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
24
24
|
"bin",
|
|
25
|
+
"docs",
|
|
25
26
|
"README.md",
|
|
26
27
|
"LICENSE"
|
|
27
28
|
],
|