repo-do 1.2.0 → 1.3.0

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.
Files changed (52) hide show
  1. package/README.md +405 -333
  2. package/dist/cli.js +16 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/add.d.ts +3 -0
  5. package/dist/commands/add.d.ts.map +1 -1
  6. package/dist/commands/add.js +66 -4
  7. package/dist/commands/add.js.map +1 -1
  8. package/dist/commands/config.d.ts.map +1 -1
  9. package/dist/commands/config.js +1 -0
  10. package/dist/commands/config.js.map +1 -1
  11. package/dist/commands/find.js +1 -1
  12. package/dist/commands/find.js.map +1 -1
  13. package/dist/commands/list.d.ts.map +1 -1
  14. package/dist/commands/list.js +8 -3
  15. package/dist/commands/list.js.map +1 -1
  16. package/dist/commands/remove.js +1 -1
  17. package/dist/commands/remove.js.map +1 -1
  18. package/dist/commands/scan.d.ts +2 -0
  19. package/dist/commands/scan.d.ts.map +1 -0
  20. package/dist/commands/scan.js +29 -0
  21. package/dist/commands/scan.js.map +1 -0
  22. package/dist/constants/index.d.ts +1 -0
  23. package/dist/constants/index.d.ts.map +1 -1
  24. package/dist/constants/index.js +1 -0
  25. package/dist/constants/index.js.map +1 -1
  26. package/dist/core/config-manager.d.ts.map +1 -1
  27. package/dist/core/config-manager.js +7 -1
  28. package/dist/core/config-manager.js.map +1 -1
  29. package/dist/core/git-url-parser.d.ts +1 -0
  30. package/dist/core/git-url-parser.d.ts.map +1 -1
  31. package/dist/core/git-url-parser.js +27 -25
  32. package/dist/core/git-url-parser.js.map +1 -1
  33. package/dist/core/repository-manager.d.ts +11 -2
  34. package/dist/core/repository-manager.d.ts.map +1 -1
  35. package/dist/core/repository-manager.js +230 -14
  36. package/dist/core/repository-manager.js.map +1 -1
  37. package/dist/core/repository-registry.d.ts +22 -0
  38. package/dist/core/repository-registry.d.ts.map +1 -0
  39. package/dist/core/repository-registry.js +104 -0
  40. package/dist/core/repository-registry.js.map +1 -0
  41. package/dist/index.d.ts +9 -3
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +10 -2
  44. package/dist/index.js.map +1 -1
  45. package/dist/types/index.d.ts +34 -0
  46. package/dist/types/index.d.ts.map +1 -1
  47. package/dist/types/index.js.map +1 -1
  48. package/dist/utils/git-executor.d.ts +16 -2
  49. package/dist/utils/git-executor.d.ts.map +1 -1
  50. package/dist/utils/git-executor.js +35 -8
  51. package/dist/utils/git-executor.js.map +1 -1
  52. package/package.json +3 -3
package/README.md CHANGED
@@ -1,333 +1,405 @@
1
- <div align="center">
2
-
3
- # repo-do
4
-
5
- A unified CLI tool for managing git repositories with a structured directory layout.
6
- Organize all your repositories in a consistent domain-based structure.
7
- Fast search, clipboard integration, and cross-platform support.
8
-
9
- English · [简体中文](./docs/README.zh-CN.md)
10
-
11
- [![npm version](https://img.shields.io/npm/v/repo-do.svg?style=flat-square)](https://www.npmjs.com/package/repo-do)
12
- [![license](https://img.shields.io/npm/l/repo-do.svg?style=flat-square)](https://github.com/STDSuperman/repo-do/blob/master/LICENSE)
13
- [![node version](https://img.shields.io/node/v/repo-do.svg?style=flat-square)](https://nodejs.org)
14
- [![downloads](https://img.shields.io/npm/dm/repo-do.svg?style=flat-square)](https://www.npmjs.com/package/repo-do)
15
-
16
- </div>
17
-
18
- ## Overview
19
-
20
- `repo-do` helps you organize all your git repositories in a consistent, domain-based directory structure. It automatically clones repositories to organized paths and provides fast search capabilities to find and navigate to your projects.
21
-
22
- ## Features
23
-
24
- - **Structured Organization**: Clone repositories to `{baseDir}/{domain}/{group}/{repo}` structure
25
- - **Fast Repository Search**: Quickly find repositories by name or path fragments
26
- - **Clipboard Integration**: Automatically copy `cd` commands to clipboard
27
- - **Cache-Based Performance**: Fast repository listing without repeated directory scans
28
- - **Cross-Platform**: Works on Windows, macOS, and Linux
29
- - **Git Clone Pass-through**: Support all git clone arguments (--depth, --branch, etc.)
30
-
31
- ## Installation
32
-
33
- ```bash
34
- npm install -g repo-do
35
- ```
36
-
37
- > **Tip**: After installation, you can use the shorter command `rpd` instead of `repo-do` for faster typing!
38
-
39
- ## Quick Start
40
-
41
- ### 1. Initialize Configuration
42
-
43
- ```bash
44
- repo-do init
45
- ```
46
-
47
- This prompts you to set a base directory for storing repositories (default: `~/.repo-do/repo`).
48
-
49
- ### 2. Clone a Repository
50
-
51
- ```bash
52
- repo-do add git@github.com:STDSuperman/super-image-cropper.git
53
- ```
54
-
55
- The repository will be cloned to:
56
- ```
57
- {baseDir}/github.com/STDSuperman/super-image-cropper
58
- ```
59
-
60
- The `cd` command is automatically copied to your clipboard!
61
-
62
- ### 3. Find a Repository
63
-
64
- ```bash
65
- repo-do find super-image
66
- ```
67
-
68
- Output:
69
- ```
70
- Found 1 repository:
71
- 1. D:\Code\github.com\STDSuperman\super-image-cropper
72
- ```
73
-
74
- ### 4. List All Repositories
75
-
76
- ```bash
77
- repo-do list
78
- ```
79
-
80
- Output:
81
- ```
82
- github.com/STDSuperman/super-image-cropper
83
- github.com/STDSuperman/NanoBanana-PPT-Skills
84
- gitlab.com/myorg/internal-tool
85
-
86
- Total: 3 repositories
87
- ```
88
-
89
- ## Commands
90
-
91
- ### `repo-do init`
92
-
93
- Initialize configuration and set the base directory for repositories.
94
-
95
- ```bash
96
- repo-do init
97
- ```
98
-
99
- ### `repo-do add <repo_url> [git-clone-args...]`
100
-
101
- Clone a repository to the structured directory.
102
-
103
- **Supported URL formats:**
104
- - HTTPS: `https://github.com/user/repo.git` or `https://github.com/user/repo`
105
- - SSH: `git@github.com:user/repo.git` or `ssh://git@github.com/user/repo.git`
106
-
107
- **Examples:**
108
-
109
- ```bash
110
- # Basic clone
111
- repo-do add git@github.com:STDSuperman/super-image-cropper.git
112
-
113
- # Shallow clone
114
- repo-do add https://github.com/STDSuperman/super-image-cropper.git --depth 1
115
-
116
- # Clone specific branch
117
- repo-do add https://github.com/STDSuperman/super-image-cropper.git --branch develop
118
-
119
- # SSH clone
120
- repo-do add git@github.com:STDSuperman/NanoBanana-PPT-Skills.git
121
- ```
122
-
123
- **Directory structure:**
124
- ```
125
- {baseDir}/
126
- ├── github.com/
127
- │ └── STDSuperman/
128
- │ ├── super-image-cropper/
129
- │ └── NanoBanana-PPT-Skills/
130
- └── gitlab.com/
131
- └── myorg/
132
- └── internal-tool/
133
- ```
134
-
135
- ### `repo-do find <query>`
136
-
137
- Search for repositories by name, group, or path fragment (case-insensitive).
138
-
139
- ```bash
140
- repo-do find super-image
141
- repo-do find STDSuperman
142
- repo-do find github.com
143
- ```
144
-
145
- **Output format:**
146
- ```
147
- Found 2 repositories:
148
- 1. D:\Code\github.com\STDSuperman\super-image-cropper
149
- 2. D:\Code\github.com\STDSuperman\NanoBanana-PPT-Skills
150
- ```
151
-
152
- Each result is prefixed with a number, followed by the absolute path.
153
-
154
- ### `repo-do list [--refresh]`
155
-
156
- List all managed repositories.
157
-
158
- ```bash
159
- # List from cache (fast)
160
- repo-do list
161
-
162
- # Force rebuild cache
163
- repo-do list --refresh
164
- ```
165
-
166
- ### `repo-do remove <repo>`
167
-
168
- Remove a repository from tracking (does not delete files).
169
-
170
- ```bash
171
- repo-do remove super-image
172
- ```
173
-
174
- If multiple matches are found, you'll be prompted to select which one to remove.
175
-
176
- ### `repo-do config [options]`
177
-
178
- View or modify configuration.
179
-
180
- ```bash
181
- # Show current config
182
- repo-do config
183
-
184
- # Get base directory
185
- repo-do config --get baseDirectory
186
-
187
- # Set base directory
188
- repo-do config --set baseDirectory /path/to/repos
189
- ```
190
-
191
- ## Directory Structure
192
-
193
- All repositories are organized in a consistent structure:
194
-
195
- ```
196
- {baseDirectory}/{domain}/{group}/{repository}
197
- ```
198
-
199
- **Examples:**
200
-
201
- | Git URL | Cloned Path |
202
- |---------|-------------|
203
- | `git@github.com:STDSuperman/super-image-cropper.git` | `{baseDir}/github.com/STDSuperman/super-image-cropper` |
204
- | `git@gitlab.com:myorg/myrepo.git` | `{baseDir}/gitlab.com/myorg/myrepo` |
205
- | `https://github.com/STDSuperman/NanoBanana-PPT-Skills.git` | `{baseDir}/github.com/STDSuperman/NanoBanana-PPT-Skills` |
206
-
207
- ## Configuration
208
-
209
- Configuration is stored in `~/.repo-do/config.json`:
210
-
211
- ```json
212
- {
213
- "baseDirectory": "D:\\Code",
214
- "version": "1.0.0"
215
- }
216
- ```
217
-
218
- ## Cache System
219
-
220
- To improve performance, `repo-do` maintains a repository cache at `~/.repo-do/repo_cache.json`.
221
-
222
- **Cache is automatically updated when:**
223
- - Adding a new repository (`repo-do add`)
224
- - Removing a repository (`repo-do remove`)
225
- - Forcing refresh (`repo-do list --refresh`)
226
-
227
- **Cache format:**
228
- ```json
229
- {
230
- "repositories": [
231
- {
232
- "name": "super-image-cropper",
233
- "fullPath": "D:\\Code\\github.com\\STDSuperman\\super-image-cropper",
234
- "gitUrl": "git@github.com:STDSuperman/super-image-cropper.git",
235
- "domain": "github.com",
236
- "group": "STDSuperman",
237
- "lastUpdated": "2026-01-11T12:00:00.000Z"
238
- }
239
- ],
240
- "lastUpdated": "2026-01-11T12:00:00.000Z"
241
- }
242
- ```
243
-
244
- ## Cross-Platform Support
245
-
246
- ### Clipboard Support
247
-
248
- - **macOS**: Uses `pbcopy`
249
- - **Linux**: Uses `xclip` or `xsel` (may require installation)
250
- - **Windows**: Uses `clip` command
251
-
252
- If clipboard fails, the path is still displayed in the terminal.
253
-
254
- ### Path Handling
255
-
256
- All paths are handled using Node.js `path` module for cross-platform compatibility.
257
-
258
- ## Requirements
259
-
260
- - Node.js >= 18.0.0
261
- - Git installed and available in PATH
262
-
263
- ## Error Handling
264
-
265
- `repo-do` provides clear error messages for common issues:
266
-
267
- - **INVALID_URL**: Git URL format not recognized
268
- - **CLONE_FAILED**: Git clone operation failed
269
- - **CONFIG_ERROR**: Configuration file read/write error
270
- - **NOT_FOUND**: Repository not found in cache
271
- - **PERMISSION_DENIED**: File system permission error
272
- - **GIT_NOT_INSTALLED**: Git is not installed
273
-
274
- ## Development
275
-
276
- ```bash
277
- # Clone the repository
278
- git clone https://github.com/your-username/repo-do.git
279
- cd repo-do
280
-
281
- # Install dependencies
282
- npm install
283
-
284
- # Run in development mode
285
- npm run dev
286
-
287
- # Build
288
- npm run build
289
-
290
- # Run tests
291
- npm test
292
- ```
293
-
294
- ## Project Structure
295
-
296
- ```
297
- repo-do/
298
- ├── src/
299
- │ ├── commands/ # CLI command implementations
300
- │ ├── core/ # Core business logic
301
- │ ├── utils/ # Utility functions
302
- │ ├── types/ # TypeScript type definitions
303
- │ ├── constants/ # Constants
304
- │ └── index.ts # CLI entry point
305
- ├── bin/
306
- │ └── repo-do.js # Executable entry
307
- ├── dist/ # Compiled output
308
- └── tests/ # Test files
309
- ```
310
-
311
- ## Dependencies
312
-
313
- - **chalk**: Terminal text styling
314
- - **clipboardy**: Cross-platform clipboard operations
315
- - **commander**: CLI framework
316
- - **inquirer**: Interactive command line prompts
317
- - **ora**: Elegant terminal spinner
318
-
319
- ## License
320
-
321
- MIT
322
-
323
- ## Contributing
324
-
325
- Contributions are welcome! Please feel free to submit a Pull Request.
326
-
327
- ## Changelog
328
-
329
- ### 1.0.0
330
- - Initial release
331
- - Core functionality: init, add, list, find, remove, config
332
- - Cross-platform support
333
- - Cache system for fast repository listing
1
+ <div align="center">
2
+
3
+ # repo-do
4
+
5
+ A unified CLI tool for managing git repositories with a structured directory layout.
6
+ Organize all your repositories in a consistent domain-based structure.
7
+ Fast search, clipboard integration, and cross-platform support.
8
+
9
+ English · [简体中文](./docs/README.zh-CN.md)
10
+
11
+ [![npm version](https://img.shields.io/npm/v/repo-do.svg?style=flat-square)](https://www.npmjs.com/package/repo-do)
12
+ [![license](https://img.shields.io/npm/l/repo-do.svg?style=flat-square)](https://github.com/STDSuperman/repo-do/blob/master/LICENSE)
13
+ [![node version](https://img.shields.io/node/v/repo-do.svg?style=flat-square)](https://nodejs.org)
14
+ [![downloads](https://img.shields.io/npm/dm/repo-do.svg?style=flat-square)](https://www.npmjs.com/package/repo-do)
15
+
16
+ </div>
17
+
18
+ ## Overview
19
+
20
+ `repo-do` helps you organize all your git repositories in a consistent, domain-based directory structure. It automatically clones repositories to organized paths and provides fast search capabilities to find and navigate to your projects.
21
+
22
+ ## Features
23
+
24
+ - **Structured Organization**: Clone repositories to `{baseDir}/{domain}/{group}/{repo}` structure
25
+ - **Fast Repository Search**: Quickly find repositories by name or path fragments
26
+ - **Clipboard Integration**: Automatically copy `cd` commands to clipboard
27
+ - **Cache-Based Performance**: Fast repository listing without repeated directory scans
28
+ - **Existing Repository Detection**: Track existing clones by remote URL and reuse them before cloning duplicates
29
+ - **Multi-Location Tracking**: Keep multiple local directories for the same remote repository when needed
30
+ - **Cross-Platform**: Works on Windows, macOS, and Linux
31
+ - **Git Clone Pass-through**: Support all git clone arguments (--depth, --branch, etc.)
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ npm install -g repo-do
37
+ ```
38
+
39
+ > **Tip**: After installation, you can use the shorter command `rpd` instead of `repo-do` for faster typing!
40
+
41
+ ## Quick Start
42
+
43
+ ### 1. Initialize Configuration
44
+
45
+ ```bash
46
+ repo-do init
47
+ ```
48
+
49
+ This prompts you to set a base directory for storing repositories (default: `~/.repo-do/repo`).
50
+
51
+ ### 2. Clone a Repository
52
+
53
+ ```bash
54
+ repo-do add git@github.com:STDSuperman/super-image-cropper.git
55
+ ```
56
+
57
+ The repository will be cloned to:
58
+ ```
59
+ {baseDir}/github.com/STDSuperman/super-image-cropper
60
+ ```
61
+
62
+ The `cd` command is automatically copied to your clipboard!
63
+
64
+ ### 3. Find a Repository
65
+
66
+ ```bash
67
+ repo-do find super-image
68
+ ```
69
+
70
+ Output:
71
+ ```
72
+ Found 1 repository:
73
+ 1. D:\Code\github.com\STDSuperman\super-image-cropper
74
+ ```
75
+
76
+ ### 4. List All Repositories
77
+
78
+ ```bash
79
+ repo-do list
80
+ ```
81
+
82
+ Output:
83
+ ```
84
+ github.com/STDSuperman/super-image-cropper
85
+ github.com/STDSuperman/NanoBanana-PPT-Skills
86
+ gitlab.com/myorg/internal-tool
87
+
88
+ Total: 3 repositories
89
+ ```
90
+
91
+ ## Commands
92
+
93
+ ### `repo-do init`
94
+
95
+ Initialize configuration and set the base directory for repositories.
96
+
97
+ ```bash
98
+ repo-do init
99
+ ```
100
+
101
+ ### `repo-do add <repo_url> [git-clone-args...]`
102
+
103
+ Clone a repository to the structured directory.
104
+
105
+ **Supported URL formats:**
106
+ - HTTPS: `https://github.com/user/repo.git` or `https://github.com/user/repo`
107
+ - SSH: `git@github.com:user/repo.git` or `ssh://git@github.com/user/repo.git`
108
+
109
+ **Examples:**
110
+
111
+ ```bash
112
+ # Basic clone
113
+ repo-do add git@github.com:STDSuperman/super-image-cropper.git
114
+
115
+ # Shallow clone
116
+ repo-do add https://github.com/STDSuperman/super-image-cropper.git --depth 1
117
+
118
+ # Clone specific branch
119
+ repo-do add https://github.com/STDSuperman/super-image-cropper.git --branch develop
120
+
121
+ # SSH clone
122
+ repo-do add git@github.com:STDSuperman/NanoBanana-PPT-Skills.git
123
+
124
+ # JSON output (for scripts and AI models)
125
+ repo-do add https://github.com/user/repo.git --json
126
+
127
+ # Force a new clone even if the same remote is already tracked
128
+ repo-do add https://github.com/user/repo.git --force-clone
129
+
130
+ # Use an already tracked local repository without prompting
131
+ repo-do add https://github.com/user/repo.git --use-existing
132
+ ```
133
+
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.
135
+
136
+ **`--json` output:**
137
+
138
+ When using `--json`, the command outputs a single line of JSON to stdout with no spinner, color, or clipboard side effects:
139
+
140
+ ```json
141
+ {"success":true,"path":"/path/to/repo","alreadyExists":false,"message":""}
142
+ ```
143
+
144
+ | Field | Type | Description |
145
+ |-------|------|-------------|
146
+ | `success` | boolean | `true` if the repo path is available (cloned or already exists) |
147
+ | `path` | string | Absolute path to the local repository |
148
+ | `alreadyExists` | boolean | `true` if the repository was already cloned |
149
+ | `adoptedExisting` | boolean | `true` if an existing repository in a different location was used |
150
+ | `message` | string | Error or status message |
151
+
152
+ On failure, the process exits with code 1 and outputs:
153
+ ```json
154
+ {"success":false,"path":"","alreadyExists":false,"message":"error details"}
155
+ ```
156
+
157
+ **Directory structure:**
158
+ ```
159
+ {baseDir}/
160
+ ├── github.com/
161
+ │ └── STDSuperman/
162
+ │ ├── super-image-cropper/
163
+ │ └── NanoBanana-PPT-Skills/
164
+ └── gitlab.com/
165
+ └── myorg/
166
+ └── internal-tool/
167
+ ```
168
+
169
+ ### `repo-do find <query>`
170
+
171
+ Search for repositories by name, group, or path fragment (case-insensitive).
172
+
173
+ ```bash
174
+ repo-do find super-image
175
+ repo-do find STDSuperman
176
+ repo-do find github.com
177
+ ```
178
+
179
+ **Output format:**
180
+ ```
181
+ Found 2 repositories:
182
+ 1. D:\Code\github.com\STDSuperman\super-image-cropper
183
+ 2. D:\Code\github.com\STDSuperman\NanoBanana-PPT-Skills
184
+ ```
185
+
186
+ Each result is prefixed with a number, followed by the absolute path.
187
+
188
+ ### `repo-do list [--refresh]`
189
+
190
+ List all managed repositories.
191
+
192
+ ```bash
193
+ # List from cache (fast)
194
+ repo-do list
195
+
196
+ # Force rebuild cache
197
+ repo-do list --refresh
198
+ ```
199
+
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
+
202
+ ### `repo-do scan [paths...]`
203
+
204
+ Scan existing Git repositories and track them in configuration.
205
+
206
+ ```bash
207
+ # Scan the configured base directory
208
+ repo-do scan
209
+
210
+ # Scan one or more custom directories
211
+ repo-do scan ~/Code ~/work
212
+ ```
213
+
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
+
216
+ ### `repo-do remove <repo>`
217
+
218
+ Remove a repository from tracking (does not delete files).
219
+
220
+ ```bash
221
+ repo-do remove super-image
222
+ ```
223
+
224
+ If multiple matches are found, you'll be prompted to select which one to remove.
225
+
226
+ ### `repo-do config [options]`
227
+
228
+ View or modify configuration.
229
+
230
+ ```bash
231
+ # Show current config
232
+ repo-do config
233
+
234
+ # Get base directory
235
+ repo-do config --get baseDirectory
236
+
237
+ # Set base directory
238
+ repo-do config --set baseDirectory /path/to/repos
239
+ ```
240
+
241
+ ## Directory Structure
242
+
243
+ All repositories are organized in a consistent structure:
244
+
245
+ ```
246
+ {baseDirectory}/{domain}/{group}/{repository}
247
+ ```
248
+
249
+ **Examples:**
250
+
251
+ | Git URL | Cloned Path |
252
+ |---------|-------------|
253
+ | `git@github.com:STDSuperman/super-image-cropper.git` | `{baseDir}/github.com/STDSuperman/super-image-cropper` |
254
+ | `git@gitlab.com:myorg/myrepo.git` | `{baseDir}/gitlab.com/myorg/myrepo` |
255
+ | `https://github.com/STDSuperman/NanoBanana-PPT-Skills.git` | `{baseDir}/github.com/STDSuperman/NanoBanana-PPT-Skills` |
256
+
257
+ ## Configuration
258
+
259
+ Configuration is stored in `~/.repo-do/config.json`:
260
+
261
+ ```json
262
+ {
263
+ "baseDirectory": "D:\\Code",
264
+ "version": "1.0.0",
265
+ "repositories": [
266
+ {
267
+ "id": "github.com/STDSuperman/super-image-cropper",
268
+ "canonicalRemote": "github.com/STDSuperman/super-image-cropper",
269
+ "displayUrl": "git@github.com:STDSuperman/super-image-cropper.git",
270
+ "domain": "github.com",
271
+ "group": "STDSuperman",
272
+ "name": "super-image-cropper",
273
+ "preferredPath": "D:\\Code\\github.com\\STDSuperman\\super-image-cropper",
274
+ "locations": [
275
+ {
276
+ "path": "D:\\Code\\github.com\\STDSuperman\\super-image-cropper",
277
+ "remoteUrl": "git@github.com:STDSuperman/super-image-cropper.git",
278
+ "remoteName": "origin",
279
+ "source": "clone",
280
+ "firstSeenAt": "2026-01-11T12:00:00.000Z",
281
+ "lastSeenAt": "2026-01-11T12:00:00.000Z"
282
+ }
283
+ ]
284
+ }
285
+ ]
286
+ }
287
+ ```
288
+
289
+ ## Cache System
290
+
291
+ To improve performance, `repo-do` maintains a repository cache at `~/.repo-do/repo_cache.json`.
292
+
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`)
297
+
298
+ **Cache format:**
299
+ ```json
300
+ {
301
+ "repositories": [
302
+ {
303
+ "name": "super-image-cropper",
304
+ "fullPath": "D:\\Code\\github.com\\STDSuperman\\super-image-cropper",
305
+ "gitUrl": "git@github.com:STDSuperman/super-image-cropper.git",
306
+ "domain": "github.com",
307
+ "group": "STDSuperman",
308
+ "lastUpdated": "2026-01-11T12:00:00.000Z"
309
+ }
310
+ ],
311
+ "lastUpdated": "2026-01-11T12:00:00.000Z"
312
+ }
313
+ ```
314
+
315
+ ## Cross-Platform Support
316
+
317
+ ### Clipboard Support
318
+
319
+ - **macOS**: Uses `pbcopy`
320
+ - **Linux**: Uses `xclip` or `xsel` (may require installation)
321
+ - **Windows**: Uses `clip` command
322
+
323
+ If clipboard fails, the path is still displayed in the terminal.
324
+
325
+ ### Path Handling
326
+
327
+ All paths are handled using Node.js `path` module for cross-platform compatibility.
328
+
329
+ ## Requirements
330
+
331
+ - Node.js >= 18.0.0
332
+ - Git installed and available in PATH
333
+
334
+ ## Error Handling
335
+
336
+ `repo-do` provides clear error messages for common issues:
337
+
338
+ - **INVALID_URL**: Git URL format not recognized
339
+ - **CLONE_FAILED**: Git clone operation failed
340
+ - **CONFIG_ERROR**: Configuration file read/write error
341
+ - **NOT_FOUND**: Repository not found in cache
342
+ - **PERMISSION_DENIED**: File system permission error
343
+ - **GIT_NOT_INSTALLED**: Git is not installed
344
+ - **PATH_CONFLICT**: Target path exists but is not the requested repository
345
+
346
+ ## Development
347
+
348
+ ```bash
349
+ # Clone the repository
350
+ git clone https://github.com/your-username/repo-do.git
351
+ cd repo-do
352
+
353
+ # Install dependencies
354
+ npm install
355
+
356
+ # Run in development mode
357
+ npm run dev
358
+
359
+ # Build
360
+ npm run build
361
+
362
+ # Run tests
363
+ npm test
364
+ ```
365
+
366
+ ## Project Structure
367
+
368
+ ```
369
+ repo-do/
370
+ ├── src/
371
+ │ ├── commands/ # CLI command implementations
372
+ │ ├── core/ # Core business logic
373
+ │ ├── utils/ # Utility functions
374
+ │ ├── types/ # TypeScript type definitions
375
+ │ ├── constants/ # Constants
376
+ │ └── index.ts # CLI entry point
377
+ ├── bin/
378
+ │ └── repo-do.js # Executable entry
379
+ ├── dist/ # Compiled output
380
+ └── tests/ # Test files
381
+ ```
382
+
383
+ ## Dependencies
384
+
385
+ - **chalk**: Terminal text styling
386
+ - **clipboardy**: Cross-platform clipboard operations
387
+ - **commander**: CLI framework
388
+ - **inquirer**: Interactive command line prompts
389
+ - **ora**: Elegant terminal spinner
390
+
391
+ ## License
392
+
393
+ MIT
394
+
395
+ ## Contributing
396
+
397
+ Contributions are welcome! Please feel free to submit a Pull Request.
398
+
399
+ ## Changelog
400
+
401
+ ### 1.0.0
402
+ - Initial release
403
+ - Core functionality: init, add, list, find, remove, config
404
+ - Cross-platform support
405
+ - Cache system for fast repository listing