dipship 1.0.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.
- package/LICENSE +21 -0
- package/README.md +72 -0
- package/bin/dipship +307 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Centricle LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# dipship
|
|
2
|
+
|
|
3
|
+
YOLO deployment. Git add, commit, push.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
$ dipship
|
|
7
|
+
dipship · 3 files changed
|
|
8
|
+
YOLO? [Y/n] █
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That's it. One command. Everything staged, committed, pushed.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i -g dipship
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Requires git and bash. The npm package is just a delivery vehicle — no Node runtime at invocation.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
dipship # Interactive — prompts before shipping
|
|
25
|
+
dipship "fixed the thing" # Commit with message
|
|
26
|
+
dipship -m "fixed the thing" # Same thing
|
|
27
|
+
dipship --yolo # Skip the prompt, just ship
|
|
28
|
+
dipship --dry-run # See what would happen
|
|
29
|
+
dipship uninstall # Remove dipship and all config
|
|
30
|
+
dipship uninstall --force # Remove everything without prompts
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Config
|
|
34
|
+
|
|
35
|
+
dipship uses source-able bash files. No JSON, no YAML, no parser.
|
|
36
|
+
|
|
37
|
+
**Global** `~/.dipship`:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
DIPSHIP_YOLO_REPOS=(
|
|
41
|
+
~/Projects/scratch
|
|
42
|
+
~/Projects/dotfiles
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Per-repo** `.dipship` in repo root:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
DIPSHIP_YOLO=true
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
YOLO-configured repos get a different prompt tone but still confirm. Only `--yolo` skips the prompt entirely.
|
|
53
|
+
|
|
54
|
+
## Uninstall
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
dipship uninstall
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Removes global config (`~/.dipship`), per-repo `.dipship` files, npx cache entries, and the global npm package. Prompts before each removal.
|
|
61
|
+
|
|
62
|
+
`dipship uninstall --force` skips all prompts.
|
|
63
|
+
|
|
64
|
+
## Edge cases
|
|
65
|
+
|
|
66
|
+
- **No changes** — "Nothing to ship.", exit 0
|
|
67
|
+
- **Not a git repo** — error, exit 1
|
|
68
|
+
- **No remote** — error, exit 1
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|
package/bin/dipship
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# ---------------------------------------------------------------------------
|
|
5
|
+
# dipship — YOLO deployment. Git add, commit, push.
|
|
6
|
+
# ---------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
VERSION="1.0.0"
|
|
9
|
+
|
|
10
|
+
# Defaults
|
|
11
|
+
DIPSHIP_YOLO=false
|
|
12
|
+
DIPSHIP_MESSAGE="dipship"
|
|
13
|
+
DRY_RUN=false
|
|
14
|
+
DIPSHIP_YOLO_REPOS=()
|
|
15
|
+
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
17
|
+
# Config loading
|
|
18
|
+
# ---------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
# Global config
|
|
21
|
+
[[ -f "$HOME/.dipship" ]] && source "$HOME/.dipship"
|
|
22
|
+
|
|
23
|
+
# Per-repo config (overrides global)
|
|
24
|
+
[[ -f "./.dipship" ]] && source "./.dipship"
|
|
25
|
+
|
|
26
|
+
# Check if PWD is in YOLO repos list
|
|
27
|
+
for repo in "${DIPSHIP_YOLO_REPOS[@]+"${DIPSHIP_YOLO_REPOS[@]}"}"; do
|
|
28
|
+
resolved=$(cd "$repo" 2>/dev/null && pwd -P) || continue
|
|
29
|
+
if [[ "$(pwd -P)" == "$resolved" ]]; then
|
|
30
|
+
DIPSHIP_YOLO=true
|
|
31
|
+
break
|
|
32
|
+
fi
|
|
33
|
+
done
|
|
34
|
+
|
|
35
|
+
# ---------------------------------------------------------------------------
|
|
36
|
+
# Arg parsing
|
|
37
|
+
# ---------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
YOLO_FLAG=false
|
|
40
|
+
MESSAGE_SET=false
|
|
41
|
+
|
|
42
|
+
usage() {
|
|
43
|
+
cat <<'EOF'
|
|
44
|
+
dipship — YOLO deployment. Git add, commit, push.
|
|
45
|
+
|
|
46
|
+
Usage:
|
|
47
|
+
dipship Interactive commit & push
|
|
48
|
+
dipship "message" Commit with message & push
|
|
49
|
+
dipship -m "message" Same thing
|
|
50
|
+
dipship --yolo Skip prompt, just ship
|
|
51
|
+
dipship --dry-run Show what would happen
|
|
52
|
+
dipship uninstall Remove dipship and all config
|
|
53
|
+
dipship uninstall --force Remove everything without prompts
|
|
54
|
+
|
|
55
|
+
Flags:
|
|
56
|
+
--yolo Skip confirmation prompt
|
|
57
|
+
--dry-run Preview without executing
|
|
58
|
+
-m "msg" Commit message
|
|
59
|
+
-h, --help Show this help
|
|
60
|
+
-v, --version Show version
|
|
61
|
+
|
|
62
|
+
Config:
|
|
63
|
+
~/.dipship Global config (bash, source-able)
|
|
64
|
+
./.dipship Per-repo config (bash, source-able)
|
|
65
|
+
|
|
66
|
+
Set DIPSHIP_YOLO=true or list repos in DIPSHIP_YOLO_REPOS.
|
|
67
|
+
EOF
|
|
68
|
+
exit 0
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
# ---------------------------------------------------------------------------
|
|
72
|
+
# Uninstall
|
|
73
|
+
# ---------------------------------------------------------------------------
|
|
74
|
+
|
|
75
|
+
_confirm() {
|
|
76
|
+
local prompt="$1"
|
|
77
|
+
if [[ "$FORCE_UNINSTALL" == true ]]; then
|
|
78
|
+
return 0
|
|
79
|
+
fi
|
|
80
|
+
read -r -p "$prompt [y/N] " answer
|
|
81
|
+
[[ "$answer" =~ ^[Yy]$ ]]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
dipship_uninstall() {
|
|
85
|
+
local removed=()
|
|
86
|
+
local kept=()
|
|
87
|
+
|
|
88
|
+
echo "dipship uninstall"
|
|
89
|
+
echo ""
|
|
90
|
+
|
|
91
|
+
# 1. Global config
|
|
92
|
+
if [[ -f "$HOME/.dipship" ]]; then
|
|
93
|
+
if _confirm "Remove global config ~/.dipship?"; then
|
|
94
|
+
rm "$HOME/.dipship"
|
|
95
|
+
removed+=("~/.dipship")
|
|
96
|
+
else
|
|
97
|
+
kept+=("~/.dipship")
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# 2. Per-repo configs
|
|
102
|
+
local search_dirs=()
|
|
103
|
+
for dir in "$HOME/Projects" "$HOME/Clients" "$HOME/src" "$HOME/code" "$HOME/repos" "$HOME/dev" "$HOME/workspace"; do
|
|
104
|
+
[[ -d "$dir" ]] && search_dirs+=("$dir")
|
|
105
|
+
done
|
|
106
|
+
|
|
107
|
+
local repo_configs=()
|
|
108
|
+
if [[ ${#search_dirs[@]} -gt 0 ]]; then
|
|
109
|
+
while IFS= read -r -d '' f; do
|
|
110
|
+
repo_configs+=("$f")
|
|
111
|
+
done < <(find "${search_dirs[@]}" -name ".dipship" -not -path "*/node_modules/*" -not -path "*/.git/*" -print0 2>/dev/null)
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
if [[ ${#repo_configs[@]} -gt 0 ]]; then
|
|
115
|
+
echo ""
|
|
116
|
+
echo "Found ${#repo_configs[@]} per-repo .dipship config(s):"
|
|
117
|
+
for f in "${repo_configs[@]}"; do
|
|
118
|
+
echo " $f"
|
|
119
|
+
done
|
|
120
|
+
|
|
121
|
+
if [[ ${#repo_configs[@]} -gt 3 ]]; then
|
|
122
|
+
if _confirm "Remove all ${#repo_configs[@]} per-repo configs?"; then
|
|
123
|
+
for f in "${repo_configs[@]}"; do
|
|
124
|
+
rm "$f"
|
|
125
|
+
removed+=("$f")
|
|
126
|
+
done
|
|
127
|
+
else
|
|
128
|
+
kept+=("${repo_configs[@]}")
|
|
129
|
+
fi
|
|
130
|
+
else
|
|
131
|
+
for f in "${repo_configs[@]}"; do
|
|
132
|
+
if _confirm "Remove $f?"; then
|
|
133
|
+
rm "$f"
|
|
134
|
+
removed+=("$f")
|
|
135
|
+
else
|
|
136
|
+
kept+=("$f")
|
|
137
|
+
fi
|
|
138
|
+
done
|
|
139
|
+
fi
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
# 3. npx cache
|
|
143
|
+
local npx_dir="$HOME/.npm/_npx"
|
|
144
|
+
if [[ -d "$npx_dir" ]]; then
|
|
145
|
+
local npx_removed=0
|
|
146
|
+
for entry in "$npx_dir"/*/; do
|
|
147
|
+
[[ -d "$entry" ]] || continue
|
|
148
|
+
if [[ -f "${entry}package-lock.json" ]] && grep -q '"dipship"' "${entry}package-lock.json" 2>/dev/null; then
|
|
149
|
+
rm -rf "$entry"
|
|
150
|
+
((npx_removed++))
|
|
151
|
+
fi
|
|
152
|
+
done
|
|
153
|
+
if [[ $npx_removed -gt 0 ]]; then
|
|
154
|
+
removed+=("npx cache ($npx_removed entries)")
|
|
155
|
+
fi
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
# 4. npm uninstall -g (last — this script is already in memory)
|
|
159
|
+
echo ""
|
|
160
|
+
if command -v dipship &>/dev/null; then
|
|
161
|
+
echo "Removing global npm package..."
|
|
162
|
+
npm uninstall -g dipship 2>/dev/null || true
|
|
163
|
+
removed+=("npm global package")
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
# 5. Summary
|
|
167
|
+
echo ""
|
|
168
|
+
if [[ ${#removed[@]} -gt 0 ]]; then
|
|
169
|
+
echo "Removed:"
|
|
170
|
+
for item in "${removed[@]}"; do
|
|
171
|
+
echo " ✓ $item"
|
|
172
|
+
done
|
|
173
|
+
fi
|
|
174
|
+
if [[ ${#kept[@]} -gt 0 ]]; then
|
|
175
|
+
echo "Kept:"
|
|
176
|
+
for item in "${kept[@]}"; do
|
|
177
|
+
echo " - $item"
|
|
178
|
+
done
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
# 6. Shell alias reminder
|
|
182
|
+
echo ""
|
|
183
|
+
echo "Check your shell profile for any dipship aliases you added manually."
|
|
184
|
+
|
|
185
|
+
# 7. Exit
|
|
186
|
+
echo ""
|
|
187
|
+
echo "dipship is gone. You animal."
|
|
188
|
+
exit 0
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
FORCE_UNINSTALL=false
|
|
192
|
+
|
|
193
|
+
while [[ $# -gt 0 ]]; do
|
|
194
|
+
case "$1" in
|
|
195
|
+
uninstall)
|
|
196
|
+
shift
|
|
197
|
+
if [[ "${1:-}" == "--force" ]]; then
|
|
198
|
+
FORCE_UNINSTALL=true
|
|
199
|
+
fi
|
|
200
|
+
dipship_uninstall
|
|
201
|
+
;;
|
|
202
|
+
--yolo)
|
|
203
|
+
YOLO_FLAG=true
|
|
204
|
+
shift
|
|
205
|
+
;;
|
|
206
|
+
--dry-run)
|
|
207
|
+
DRY_RUN=true
|
|
208
|
+
shift
|
|
209
|
+
;;
|
|
210
|
+
-m)
|
|
211
|
+
if [[ -z "${2:-}" ]]; then
|
|
212
|
+
echo "dipship: -m requires a message" >&2
|
|
213
|
+
exit 1
|
|
214
|
+
fi
|
|
215
|
+
DIPSHIP_MESSAGE="$2"
|
|
216
|
+
MESSAGE_SET=true
|
|
217
|
+
shift 2
|
|
218
|
+
;;
|
|
219
|
+
-h|--help)
|
|
220
|
+
usage
|
|
221
|
+
;;
|
|
222
|
+
-v|--version)
|
|
223
|
+
echo "dipship $VERSION"
|
|
224
|
+
exit 0
|
|
225
|
+
;;
|
|
226
|
+
-*)
|
|
227
|
+
echo "dipship: unknown flag '$1'" >&2
|
|
228
|
+
echo "Try 'dipship --help'" >&2
|
|
229
|
+
exit 1
|
|
230
|
+
;;
|
|
231
|
+
*)
|
|
232
|
+
# Positional = commit message
|
|
233
|
+
DIPSHIP_MESSAGE="$1"
|
|
234
|
+
MESSAGE_SET=true
|
|
235
|
+
shift
|
|
236
|
+
;;
|
|
237
|
+
esac
|
|
238
|
+
done
|
|
239
|
+
|
|
240
|
+
# ---------------------------------------------------------------------------
|
|
241
|
+
# Preflight
|
|
242
|
+
# ---------------------------------------------------------------------------
|
|
243
|
+
|
|
244
|
+
# Must be in a git repo
|
|
245
|
+
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
|
|
246
|
+
echo "dipship: not a git repo" >&2
|
|
247
|
+
exit 1
|
|
248
|
+
fi
|
|
249
|
+
|
|
250
|
+
# Must have a remote
|
|
251
|
+
if ! git remote get-url origin &>/dev/null; then
|
|
252
|
+
echo "dipship: no remote 'origin' configured" >&2
|
|
253
|
+
exit 1
|
|
254
|
+
fi
|
|
255
|
+
|
|
256
|
+
# Check for changes
|
|
257
|
+
changes=$(git status --porcelain)
|
|
258
|
+
if [[ -z "$changes" ]]; then
|
|
259
|
+
echo "Nothing to ship."
|
|
260
|
+
exit 0
|
|
261
|
+
fi
|
|
262
|
+
|
|
263
|
+
file_count=$(echo "$changes" | wc -l | tr -d ' ')
|
|
264
|
+
branch=$(git symbolic-ref --short HEAD 2>/dev/null || echo "detached")
|
|
265
|
+
remote_url=$(git remote get-url origin)
|
|
266
|
+
|
|
267
|
+
# ---------------------------------------------------------------------------
|
|
268
|
+
# Dry run
|
|
269
|
+
# ---------------------------------------------------------------------------
|
|
270
|
+
|
|
271
|
+
if [[ "$DRY_RUN" == true ]]; then
|
|
272
|
+
echo "dipship · dry run"
|
|
273
|
+
echo " git add -A → $file_count files"
|
|
274
|
+
echo " git commit -m \"$DIPSHIP_MESSAGE\""
|
|
275
|
+
echo " git push → origin/$branch"
|
|
276
|
+
echo "Didn't ship."
|
|
277
|
+
exit 0
|
|
278
|
+
fi
|
|
279
|
+
|
|
280
|
+
# ---------------------------------------------------------------------------
|
|
281
|
+
# Prompt
|
|
282
|
+
# ---------------------------------------------------------------------------
|
|
283
|
+
|
|
284
|
+
if [[ "$YOLO_FLAG" != true ]]; then
|
|
285
|
+
if [[ "$DIPSHIP_YOLO" == true ]]; then
|
|
286
|
+
prompt="dipship · YOLO repo · $file_count files changed"$'\n'"Ship it? [Y/n] "
|
|
287
|
+
else
|
|
288
|
+
prompt="dipship · $file_count files changed"$'\n'"YOLO? [Y/n] "
|
|
289
|
+
fi
|
|
290
|
+
|
|
291
|
+
read -r -p "$prompt" answer
|
|
292
|
+
answer=${answer:-Y}
|
|
293
|
+
if [[ ! "$answer" =~ ^[Yy]$ ]]; then
|
|
294
|
+
echo "Bailed."
|
|
295
|
+
exit 0
|
|
296
|
+
fi
|
|
297
|
+
fi
|
|
298
|
+
|
|
299
|
+
# ---------------------------------------------------------------------------
|
|
300
|
+
# Ship
|
|
301
|
+
# ---------------------------------------------------------------------------
|
|
302
|
+
|
|
303
|
+
git add -A
|
|
304
|
+
git commit -m "$DIPSHIP_MESSAGE"
|
|
305
|
+
git push
|
|
306
|
+
|
|
307
|
+
echo "Shipped."
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dipship",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "YOLO deployment. Git add, commit, push.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"dipship": "bin/dipship"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/"
|
|
10
|
+
],
|
|
11
|
+
"keywords": [
|
|
12
|
+
"git",
|
|
13
|
+
"deploy",
|
|
14
|
+
"yolo",
|
|
15
|
+
"cli"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=14"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/centricle/dipship.git"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/centricle/dipship#readme",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/centricle/dipship/issues"
|
|
28
|
+
}
|
|
29
|
+
}
|