@homelab.org/git-ghost 1.0.7 → 1.0.8
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 +66 -122
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen?style=flat-square">
|
|
14
14
|
<img src="https://img.shields.io/badge/license-MIT-green?style=flat-square">
|
|
15
15
|
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square">
|
|
16
|
-
<img src="https://img.shields.io/npm/dm/@
|
|
16
|
+
<img src="https://img.shields.io/npm/dm/@homelab/git-ghost?style=flat-square">
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
19
|
---
|
|
@@ -45,34 +45,26 @@ Nothing is permanently removed without your approval. Ghost files move to `.ghos
|
|
|
45
45
|
|
|
46
46
|
**Via npm (recommended)**
|
|
47
47
|
```bash
|
|
48
|
-
npm install -g @
|
|
49
|
-
|
|
48
|
+
npm install -g @homelab/git-ghost
|
|
49
|
+
Via GitHub
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
```bash
|
|
51
|
+
bash
|
|
53
52
|
git clone https://github.com/MikeDMart/GitGhost.git
|
|
54
53
|
cd GitGhost
|
|
55
54
|
npm link
|
|
56
|
-
|
|
55
|
+
Without installing
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
```bash
|
|
57
|
+
bash
|
|
60
58
|
npx github:MikeDMart/GitGhost audit
|
|
61
|
-
|
|
59
|
+
Verify
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
```bash
|
|
61
|
+
bash
|
|
65
62
|
git-ghost --version
|
|
66
63
|
# git-ghost v1.0.0
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
> **Requires** [GitHub CLI (`gh`)](https://cli.github.com/) for the `--pr` flag. Install it and run `gh auth login` once.
|
|
70
|
-
|
|
71
|
-
---
|
|
64
|
+
Requires GitHub CLI (gh) for the --pr flag. Install it and run gh auth login once.
|
|
72
65
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
```bash
|
|
66
|
+
Quick Start
|
|
67
|
+
bash
|
|
76
68
|
# Step into your project
|
|
77
69
|
cd /path/to/your/repo
|
|
78
70
|
|
|
@@ -81,57 +73,46 @@ git-ghost audit
|
|
|
81
73
|
|
|
82
74
|
# Fix everything and open a PR for review
|
|
83
75
|
git-ghost fix --pr
|
|
84
|
-
```
|
|
85
|
-
|
|
86
76
|
That's it. Review the PR, restore anything you want back, merge when ready.
|
|
87
77
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
| `git-ghost history` | Show all previous cleanup commits |
|
|
99
|
-
| `git-ghost help` | Show usage information |
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## How it works
|
|
104
|
-
|
|
105
|
-
### Audit
|
|
106
|
-
|
|
78
|
+
Commands
|
|
79
|
+
Command Description
|
|
80
|
+
git-ghost audit Scan and report — no changes made
|
|
81
|
+
git-ghost fix Apply fixes on a new local branch
|
|
82
|
+
git-ghost fix --pr Apply fixes and open a GitHub Pull Request
|
|
83
|
+
git-ghost restore <file> Recover a file from .ghost/
|
|
84
|
+
git-ghost history Show all previous cleanup commits
|
|
85
|
+
git-ghost help Show usage information
|
|
86
|
+
How it works
|
|
87
|
+
Audit
|
|
107
88
|
GitGhost scans your working directory and reports three categories of findings:
|
|
108
89
|
|
|
109
|
-
|
|
90
|
+
Duplicate files — reads every .js, .css, .html, .json, and .md file, hashes the content with MD5, and flags any file whose hash matches another. The first occurrence is kept; duplicates are marked for removal.
|
|
110
91
|
|
|
111
|
-
|
|
92
|
+
Orphaned images — finds every .png, .jpg, .jpeg, .gif, .svg, and .webp file, then checks whether its filename or path appears anywhere in your source code. If nothing references it, it's a ghost.
|
|
112
93
|
|
|
113
|
-
|
|
94
|
+
Dead dependencies — reads dependencies and devDependencies from package.json and checks whether each package name appears in a require() or import statement anywhere in your JS/TS files. If it doesn't, it's flagged.
|
|
114
95
|
|
|
115
|
-
|
|
96
|
+
Fix
|
|
97
|
+
When you run git-ghost fix:
|
|
116
98
|
|
|
117
|
-
|
|
99
|
+
Creates a branch named fix/git-ghost-<timestamp>
|
|
118
100
|
|
|
119
|
-
|
|
120
|
-
2. Moves orphaned images to `.ghost/` (preserving directory structure)
|
|
121
|
-
3. Deletes confirmed duplicate files (keeping the first occurrence)
|
|
122
|
-
4. Commits all changes with a detailed message
|
|
123
|
-
5. Pushes the branch to origin
|
|
124
|
-
6. Optionally opens a Pull Request with a review checklist
|
|
101
|
+
Moves orphaned images to .ghost/ (preserving directory structure)
|
|
125
102
|
|
|
126
|
-
|
|
103
|
+
Deletes confirmed duplicate files (keeping the first occurrence)
|
|
127
104
|
|
|
128
|
-
|
|
105
|
+
Commits all changes with a detailed message
|
|
106
|
+
|
|
107
|
+
Pushes the branch to origin
|
|
129
108
|
|
|
130
|
-
|
|
109
|
+
Optionally opens a Pull Request with a review checklist
|
|
131
110
|
|
|
132
|
-
|
|
111
|
+
Nothing in .ghost/ is deleted — it's a quarantine folder, not a trash can.
|
|
133
112
|
|
|
134
|
-
|
|
113
|
+
Examples
|
|
114
|
+
Basic audit
|
|
115
|
+
text
|
|
135
116
|
$ git-ghost audit
|
|
136
117
|
|
|
137
118
|
👻 git-ghost audit
|
|
@@ -153,11 +134,8 @@ $ git-ghost audit
|
|
|
153
134
|
|
|
154
135
|
💡 Tip:
|
|
155
136
|
Run git-ghost fix --pr to open a PR with all fixes applied
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
### Automated cleanup with PR
|
|
159
|
-
|
|
160
|
-
```
|
|
137
|
+
Automated cleanup with PR
|
|
138
|
+
text
|
|
161
139
|
$ git-ghost fix --pr
|
|
162
140
|
|
|
163
141
|
👻 git-ghost fix
|
|
@@ -183,11 +161,8 @@ $ git-ghost fix --pr
|
|
|
183
161
|
📬 Pull Request created: https://github.com/username/my-app/pull/123
|
|
184
162
|
|
|
185
163
|
✅ Branch ready: fix/git-ghost-1743872154321
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
### Restoring a file
|
|
189
|
-
|
|
190
|
-
```
|
|
164
|
+
Restoring a file
|
|
165
|
+
text
|
|
191
166
|
$ git-ghost restore assets/old-logo.png
|
|
192
167
|
|
|
193
168
|
👻 git-ghost restore
|
|
@@ -198,11 +173,8 @@ $ git-ghost restore assets/old-logo.png
|
|
|
198
173
|
💡 To commit the restoration:
|
|
199
174
|
git add assets/old-logo.png
|
|
200
175
|
git commit -m "restore: recover assets/old-logo.png"
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
### Viewing history
|
|
204
|
-
|
|
205
|
-
```
|
|
176
|
+
Viewing history
|
|
177
|
+
text
|
|
206
178
|
$ git-ghost history
|
|
207
179
|
|
|
208
180
|
👻 git-ghost history
|
|
@@ -216,13 +188,8 @@ $ git-ghost history
|
|
|
216
188
|
|
|
217
189
|
👻 Files currently in .ghost/: 21
|
|
218
190
|
💡 To restore: git-ghost restore <file>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
---
|
|
222
|
-
|
|
223
|
-
## Project structure
|
|
224
|
-
|
|
225
|
-
```
|
|
191
|
+
Project structure
|
|
192
|
+
text
|
|
226
193
|
GitGhost/
|
|
227
194
|
├── bin/
|
|
228
195
|
│ └── git-ghost.js # CLI entry point
|
|
@@ -235,13 +202,8 @@ GitGhost/
|
|
|
235
202
|
├── .gitignore
|
|
236
203
|
├── package.json
|
|
237
204
|
└── README.md
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## Workflow
|
|
243
|
-
|
|
244
|
-
```
|
|
205
|
+
Workflow
|
|
206
|
+
text
|
|
245
207
|
your repo
|
|
246
208
|
│
|
|
247
209
|
▼
|
|
@@ -255,64 +217,46 @@ review PR on GitHub ← check what was removed, restore if needed
|
|
|
255
217
|
│
|
|
256
218
|
▼
|
|
257
219
|
merge ← repo is clean
|
|
258
|
-
```
|
|
259
|
-
|
|
260
220
|
If anything was removed by mistake:
|
|
261
221
|
|
|
262
|
-
|
|
222
|
+
text
|
|
263
223
|
git-ghost restore <file> ← pulls it back from .ghost/
|
|
264
224
|
git add <file>
|
|
265
225
|
git commit -m "restore: recover <file>"
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
---
|
|
226
|
+
Tech stack
|
|
227
|
+
Node.js — runtime
|
|
269
228
|
|
|
270
|
-
|
|
229
|
+
glob — recursive file pattern matching
|
|
271
230
|
|
|
272
|
-
|
|
273
|
-
- **glob** — recursive file pattern matching
|
|
274
|
-
- **crypto** — MD5 hashing for duplicate detection
|
|
275
|
-
- **child_process** — git and gh CLI integration
|
|
276
|
-
- **fs / path** — file operations and ghost quarantine
|
|
231
|
+
crypto — MD5 hashing for duplicate detection
|
|
277
232
|
|
|
278
|
-
|
|
233
|
+
child_process — git and gh CLI integration
|
|
279
234
|
|
|
280
|
-
|
|
235
|
+
fs / path — file operations and ghost quarantine
|
|
281
236
|
|
|
237
|
+
Contributing
|
|
282
238
|
Contributions are welcome. Here's how:
|
|
283
239
|
|
|
284
|
-
|
|
240
|
+
bash
|
|
285
241
|
# Fork the repo, then:
|
|
286
242
|
git checkout -b feature/your-feature
|
|
287
243
|
git commit -m 'feat: describe your change'
|
|
288
244
|
git push origin feature/your-feature
|
|
289
245
|
# Open a Pull Request
|
|
290
|
-
|
|
246
|
+
Found a bug? Open an issue in the issue tracker.
|
|
291
247
|
|
|
292
|
-
|
|
248
|
+
Roadmap
|
|
249
|
+
Support for more file types (PDF, DOC, SVG sprites)
|
|
293
250
|
|
|
294
|
-
|
|
251
|
+
GitHub Actions integration for automated CI runs
|
|
295
252
|
|
|
296
|
-
|
|
253
|
+
HTML audit reports
|
|
297
254
|
|
|
298
|
-
|
|
299
|
-
- [ ] GitHub Actions integration for automated CI runs
|
|
300
|
-
- [ ] HTML audit reports
|
|
301
|
-
- [ ] GitLab and Bitbucket support
|
|
302
|
-
- [ ] Config file (`.ghostrc`) for custom ignore patterns
|
|
255
|
+
GitLab and Bitbucket support
|
|
303
256
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
## License
|
|
257
|
+
Config file (.ghostrc) for custom ignore patterns
|
|
307
258
|
|
|
308
|
-
|
|
259
|
+
License
|
|
260
|
+
MIT © MikeDMart
|
|
309
261
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
<p align="center">
|
|
313
|
-
<a href="https://github.com/MikeDMart/GitGhost">⭐ Star on GitHub</a>
|
|
314
|
-
·
|
|
315
|
-
<a href="https://github.com/MikeDMart/GitGhost/issues">🐛 Report a bug</a>
|
|
316
|
-
·
|
|
317
|
-
<a href="https://github.com/MikeDMart/GitGhost/issues">💡 Request a feature</a>
|
|
318
|
-
</p>
|
|
262
|
+
<p align="center"> <a href="https://github.com/MikeDMart/GitGhost">⭐ Star on GitHub</a> · <a href="https://github.com/MikeDMart/GitGhost/issues">🐛 Report a bug</a> · <a href="https://github.com/MikeDMart/GitGhost/issues">💡 Request a feature</a> </p> ```
|
package/package.json
CHANGED