git-push-time 1.0.3 → 1.1.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/README.md +144 -63
- package/bin/index.js +199 -912
- package/lib/commands/edit-time.js +127 -0
- package/lib/commands/fix.js +105 -0
- package/lib/commands/github.js +436 -0
- package/lib/commands/pull.js +88 -0
- package/lib/commands/push.js +653 -0
- package/lib/config.js +210 -0
- package/lib/github.js +304 -0
- package/lib/prompt-helpers.js +62 -0
- package/lib/ui.js +186 -70
- package/package.json +1 -1
package/lib/ui.js
CHANGED
|
@@ -2,11 +2,11 @@ import chalk from "chalk";
|
|
|
2
2
|
import stringWidth from "string-width";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Tự động tính toán chiều rộng card linh hoạt theo Terminal (
|
|
5
|
+
* Tự động tính toán chiều rộng card linh hoạt theo Terminal (68 - 80 ký tự)
|
|
6
6
|
*/
|
|
7
|
-
function getW() {
|
|
8
|
-
const cols = process.stdout.columns ||
|
|
9
|
-
return Math.min(
|
|
7
|
+
export function getW() {
|
|
8
|
+
const cols = process.stdout.columns || 72;
|
|
9
|
+
return Math.min(80, Math.max(66, cols - 4));
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
function hexToRgb(hex) {
|
|
@@ -40,13 +40,13 @@ export function multiGradient(
|
|
|
40
40
|
.join("");
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function pad(str, len) {
|
|
43
|
+
export function pad(str, len) {
|
|
44
44
|
const vLen = stringWidth(str);
|
|
45
45
|
if (vLen >= len) return str;
|
|
46
46
|
return str + " ".repeat(len - vLen);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
function truncateVisual(str, maxLen) {
|
|
49
|
+
export function truncateVisual(str, maxLen) {
|
|
50
50
|
if (stringWidth(str) <= maxLen) return str;
|
|
51
51
|
let res = "";
|
|
52
52
|
for (const ch of str) {
|
|
@@ -59,10 +59,10 @@ function truncateVisual(str, maxLen) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/* ==========================================================================
|
|
62
|
-
|
|
62
|
+
BOX ENGINE CHUẨN (Bo góc mềm & Căn lề pixel-perfect)
|
|
63
63
|
========================================================================== */
|
|
64
64
|
|
|
65
|
-
function boxTop(title = "", borderColor = chalk.hex("#334155")) {
|
|
65
|
+
export function boxTop(title = "", borderColor = chalk.hex("#334155")) {
|
|
66
66
|
const W = getW();
|
|
67
67
|
if (!title) return borderColor("╭" + "─".repeat(W - 2) + "╮");
|
|
68
68
|
|
|
@@ -76,27 +76,32 @@ function boxTop(title = "", borderColor = chalk.hex("#334155")) {
|
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
function boxBottom(borderColor = chalk.hex("#334155")) {
|
|
79
|
+
export function boxBottom(borderColor = chalk.hex("#334155")) {
|
|
80
80
|
const W = getW();
|
|
81
81
|
return borderColor("╰" + "─".repeat(W - 2) + "╯");
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
function boxRow(content = "", borderColor = chalk.hex("#334155")) {
|
|
84
|
+
export function boxRow(content = "", borderColor = chalk.hex("#334155")) {
|
|
85
85
|
const W = getW();
|
|
86
86
|
return borderColor("│ ") + pad(content, W - 4) + borderColor(" │");
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
export function boxDivider(borderColor = chalk.hex("#334155")) {
|
|
90
|
+
const W = getW();
|
|
91
|
+
return borderColor("├" + "─".repeat(W - 2) + "┤");
|
|
92
|
+
}
|
|
93
|
+
|
|
89
94
|
/**
|
|
90
95
|
* Hàng Key-Value có đường nối bằng dấu chấm ․ ․ ․
|
|
91
96
|
*/
|
|
92
|
-
function boxKvDot(
|
|
97
|
+
export function boxKvDot(
|
|
93
98
|
label,
|
|
94
99
|
value,
|
|
95
|
-
labelWidth =
|
|
100
|
+
labelWidth = 16,
|
|
96
101
|
borderColor = chalk.hex("#334155"),
|
|
97
102
|
) {
|
|
98
103
|
const W = getW();
|
|
99
|
-
const maxValWidth = W - 6 - labelWidth;
|
|
104
|
+
const maxValWidth = Math.max(10, W - 6 - labelWidth);
|
|
100
105
|
const truncatedVal = truncateVisual(value, maxValWidth);
|
|
101
106
|
const valWidth = stringWidth(truncatedVal);
|
|
102
107
|
|
|
@@ -108,13 +113,13 @@ function boxKvDot(
|
|
|
108
113
|
}
|
|
109
114
|
|
|
110
115
|
/* ==========================================================================
|
|
111
|
-
PUBLIC INTERFACE
|
|
116
|
+
PUBLIC INTERFACE & BANNER
|
|
112
117
|
========================================================================== */
|
|
113
118
|
|
|
114
119
|
/**
|
|
115
|
-
* Banner
|
|
116
|
-
|
|
117
|
-
export function printBanner(version = "1.
|
|
120
|
+
* Banner DevTools sắc nét, hiện đại
|
|
121
|
+
*/
|
|
122
|
+
export function printBanner(version = "1.1.0") {
|
|
118
123
|
const ascii = [
|
|
119
124
|
" ____ _ _ ____ _ _____ _ ",
|
|
120
125
|
" / ___(_) |_ | _ \\ _ _ ___| |__ |_ _(_)_ __ ___ ___ ",
|
|
@@ -124,23 +129,45 @@ export function printBanner(version = "1.0.0") {
|
|
|
124
129
|
];
|
|
125
130
|
|
|
126
131
|
console.log("");
|
|
127
|
-
const colors = ["#
|
|
132
|
+
const colors = ["#818CF8", "#38BDF8", "#34D399", "#A7F3D0"];
|
|
128
133
|
ascii.forEach((l) => console.log(multiGradient(l, colors)));
|
|
129
134
|
|
|
130
135
|
const badgeVer = chalk.bgHex("#1E1B4B").hex("#818CF8").bold(` v${version} `);
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
.hex("#E0F2FE")
|
|
135
|
-
.bold(" SECRET SHIELD ");
|
|
136
|
+
const badgeGit = chalk.bgHex("#064E3B").hex("#34D399").bold(" SMART GIT ");
|
|
137
|
+
const badgeHub = chalk.bgHex("#4338CA").hex("#C7D2FE").bold(" GITHUB SYNC ");
|
|
138
|
+
const badgeShield = chalk.bgHex("#0F172A").hex("#38BDF8").bold(" SECRET SHIELD ");
|
|
136
139
|
const badgeDate = chalk.bgHex("#78350F").hex("#FDE047").bold(" BACKDATE ");
|
|
137
140
|
|
|
138
|
-
console.log(`\n ${badgeVer} ${
|
|
141
|
+
console.log(`\n ${badgeVer} ${badgeGit} ${badgeHub} ${badgeShield} ${badgeDate}\n`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Hiển thị Dashboard trạng thái ngắn gọn ở đầu menu
|
|
146
|
+
*/
|
|
147
|
+
export function printDashboardStatus({ targetDir = process.cwd(), currentBranch = 'main', githubUser = null }) {
|
|
148
|
+
const border = chalk.hex("#1E293B");
|
|
149
|
+
const W = getW();
|
|
150
|
+
|
|
151
|
+
const dirName = truncateVisual(targetDir, 32);
|
|
152
|
+
const branchText = chalk.hex("#38BDF8").bold(currentBranch);
|
|
153
|
+
|
|
154
|
+
let ghStatusText;
|
|
155
|
+
if (githubUser) {
|
|
156
|
+
ghStatusText = chalk.hex("#34D399").bold(`@${githubUser.login}`) + chalk.hex("#64748B")(' (Đã kết nối)');
|
|
157
|
+
} else {
|
|
158
|
+
ghStatusText = chalk.hex("#94A3B8")('Chưa kết nối') + chalk.hex("#64748B")(' [chọn mục GITHUB để login]');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
console.log(boxTop(chalk.hex("#475569")(" [ TRẠNG THÁI ] "), border));
|
|
162
|
+
console.log(boxKvDot("Thư mục", chalk.hex("#F8FAFC")(dirName), 14, border));
|
|
163
|
+
console.log(boxKvDot("Nhánh (Branch)", branchText, 14, border));
|
|
164
|
+
console.log(boxKvDot("GitHub Account", ghStatusText, 14, border));
|
|
165
|
+
console.log(boxBottom(border));
|
|
139
166
|
}
|
|
140
167
|
|
|
141
168
|
/**
|
|
142
|
-
* Tiêu đề phân đoạn
|
|
143
|
-
|
|
169
|
+
* Tiêu đề phân đoạn với điểm nhấn màu sắc
|
|
170
|
+
*/
|
|
144
171
|
export function printSection(title) {
|
|
145
172
|
const W = getW();
|
|
146
173
|
const clean = String(title || "").toUpperCase();
|
|
@@ -153,7 +180,7 @@ export function printSection(title) {
|
|
|
153
180
|
}
|
|
154
181
|
|
|
155
182
|
/**
|
|
156
|
-
* Pill Step Badge
|
|
183
|
+
* Pill Step Badge (Ví dụ: 1/6)
|
|
157
184
|
*/
|
|
158
185
|
export function stepLabel(current, total, text) {
|
|
159
186
|
const pill = chalk
|
|
@@ -164,7 +191,7 @@ export function stepLabel(current, total, text) {
|
|
|
164
191
|
}
|
|
165
192
|
|
|
166
193
|
/**
|
|
167
|
-
* Bảng tóm tắt thông tin trước khi Push
|
|
194
|
+
* Bảng tóm tắt thông tin trước khi Push
|
|
168
195
|
*/
|
|
169
196
|
export function printSummary({
|
|
170
197
|
repoUrl,
|
|
@@ -176,7 +203,7 @@ export function printSummary({
|
|
|
176
203
|
}) {
|
|
177
204
|
const border = chalk.hex("#475569");
|
|
178
205
|
const title = chalk.bold.bgHex("#4338CA").hex("#FFFFFF")(
|
|
179
|
-
" THÔNG TIN ĐẨY DỰ ÁN ",
|
|
206
|
+
" XÁC NHẬN THÔNG TIN ĐẨY DỰ ÁN ",
|
|
180
207
|
);
|
|
181
208
|
|
|
182
209
|
console.log("");
|
|
@@ -184,34 +211,34 @@ export function printSummary({
|
|
|
184
211
|
|
|
185
212
|
if (sourceDir) {
|
|
186
213
|
console.log(
|
|
187
|
-
boxKvDot("
|
|
214
|
+
boxKvDot("Thư mục nguồn", chalk.hex("#34D399")(sourceDir), 16, border),
|
|
188
215
|
);
|
|
189
216
|
}
|
|
190
217
|
console.log(
|
|
191
218
|
boxKvDot(
|
|
192
|
-
"Repository",
|
|
219
|
+
"Git Repository",
|
|
193
220
|
chalk.hex("#38BDF8").underline(repoUrl),
|
|
194
|
-
|
|
221
|
+
16,
|
|
195
222
|
border,
|
|
196
223
|
),
|
|
197
224
|
);
|
|
198
225
|
console.log(
|
|
199
|
-
boxKvDot("Message", chalk.hex("#FBBF24").bold(commitMsg),
|
|
226
|
+
boxKvDot("Commit Message", chalk.hex("#FBBF24").bold(commitMsg), 16, border),
|
|
200
227
|
);
|
|
201
228
|
console.log(
|
|
202
|
-
boxKvDot("Thời gian", chalk.hex("#C084FC")(dateDisplay),
|
|
229
|
+
boxKvDot("Thời gian", chalk.hex("#C084FC")(dateDisplay), 16, border),
|
|
203
230
|
);
|
|
204
231
|
|
|
205
232
|
const branchPill = chalk
|
|
206
233
|
.bgHex("#065F46")
|
|
207
234
|
.hex("#6EE7B7")
|
|
208
235
|
.bold(` ${branch} `);
|
|
209
|
-
console.log(boxKvDot("
|
|
236
|
+
console.log(boxKvDot("Nhánh đẩy lên", branchPill, 16, border));
|
|
210
237
|
|
|
211
238
|
const forceText = force
|
|
212
239
|
? chalk.bgHex("#991B1B").hex("#FCA5A5").bold(" BẬT (--force) [!] ")
|
|
213
|
-
: chalk.hex("#64748B")("Tắt (an toàn)");
|
|
214
|
-
console.log(boxKvDot("Force
|
|
240
|
+
: chalk.hex("#64748B")("Tắt (chế độ an toàn)");
|
|
241
|
+
console.log(boxKvDot("Ghi đè (Force)", forceText, 16, border));
|
|
215
242
|
|
|
216
243
|
console.log(boxBottom(border));
|
|
217
244
|
}
|
|
@@ -226,7 +253,104 @@ export function printTargetDir(dir = "") {
|
|
|
226
253
|
}
|
|
227
254
|
|
|
228
255
|
/**
|
|
229
|
-
*
|
|
256
|
+
* Hiển thị thẻ Profile thông tin tài khoản GitHub
|
|
257
|
+
*/
|
|
258
|
+
export function printGitHubProfile(user, source = '') {
|
|
259
|
+
const border = chalk.hex("#4F46E5");
|
|
260
|
+
const title = chalk.bold.bgHex("#4F46E5").hex("#FFFFFF")(
|
|
261
|
+
" TÀI KHOẢN GITHUB KẾT NỐI ",
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
console.log("");
|
|
265
|
+
console.log(boxTop(title, border));
|
|
266
|
+
|
|
267
|
+
console.log(
|
|
268
|
+
boxKvDot("Username", chalk.hex("#38BDF8").bold(`@${user.login}`), 16, border)
|
|
269
|
+
);
|
|
270
|
+
if (user.name) {
|
|
271
|
+
console.log(boxKvDot("Tên hiển thị", chalk.hex("#F8FAFC")(user.name), 16, border));
|
|
272
|
+
}
|
|
273
|
+
if (user.email) {
|
|
274
|
+
console.log(boxKvDot("Email", chalk.hex("#94A3B8")(user.email), 16, border));
|
|
275
|
+
}
|
|
276
|
+
if (user.bio) {
|
|
277
|
+
console.log(boxKvDot("Tiểu sử", chalk.hex("#CBD5E1")(truncateVisual(user.bio, 40)), 16, border));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const repoStats = `${user.public_repos || 0} public • ${user.total_private_repos || 0} private`;
|
|
281
|
+
console.log(boxKvDot("Repositories", chalk.hex("#34D399").bold(repoStats), 16, border));
|
|
282
|
+
|
|
283
|
+
if (source) {
|
|
284
|
+
const srcDesc = source === 'gh-cli' ? 'GitHub CLI (gh)' : source === 'env' ? 'Biến môi trường' : 'Lưu trữ cá nhân';
|
|
285
|
+
console.log(boxKvDot("Nguồn xác thực", chalk.hex("#A78BFA")(srcDesc), 16, border));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
console.log(boxDivider(border));
|
|
289
|
+
console.log(boxRow(chalk.hex("#64748B")(`» Trang cá nhân: ${user.html_url}`), border));
|
|
290
|
+
console.log(boxBottom(border));
|
|
291
|
+
console.log("");
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Hiển thị mã xác thực GitHub Device Flow cho người dùng
|
|
296
|
+
*/
|
|
297
|
+
export function printDeviceCodePrompt({ userCode, verificationUri }) {
|
|
298
|
+
const border = chalk.hex("#6366F1");
|
|
299
|
+
const title = chalk.bold.bgHex("#4F46E5").hex("#FFFFFF")(
|
|
300
|
+
" GITHUB OAUTH / DEVICE FLOW ",
|
|
301
|
+
);
|
|
302
|
+
|
|
303
|
+
console.log("");
|
|
304
|
+
console.log(boxTop(title, border));
|
|
305
|
+
console.log(boxRow("", border));
|
|
306
|
+
console.log(boxRow(chalk.hex("#F8FAFC").bold("Bước 1: Mở trình duyệt và truy cập liên kết:"), border));
|
|
307
|
+
console.log(boxRow(chalk.hex("#38BDF8").bold.underline(` ${verificationUri}`), border));
|
|
308
|
+
console.log(boxRow("", border));
|
|
309
|
+
console.log(boxRow(chalk.hex("#F8FAFC").bold("Bước 2: Nhập mã xác nhận (User Code):"), border));
|
|
310
|
+
|
|
311
|
+
const codeBox = chalk.bgHex("#1E1B4B").hex("#A5B4FC").bold(` >>> ${userCode} <<< `);
|
|
312
|
+
console.log(boxRow(` ${codeBox}`, border));
|
|
313
|
+
console.log(boxRow("", border));
|
|
314
|
+
console.log(boxRow(chalk.hex("#94A3B8")("» Hệ thống đang tự động mở trình duyệt cho bạn..."), border));
|
|
315
|
+
console.log(boxRow(chalk.hex("#64748B")("» Nhấn Authorize trên trình duyệt để hoàn tất."), border));
|
|
316
|
+
console.log(boxBottom(border));
|
|
317
|
+
console.log("");
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Hiển thị thông báo sau khi tạo repository GitHub mới thành công
|
|
322
|
+
*/
|
|
323
|
+
export function printRepoCreatedBox(repo) {
|
|
324
|
+
const border = chalk.hex("#059669");
|
|
325
|
+
const title = chalk.bold.bgHex("#10B981").hex("#064E3B")(
|
|
326
|
+
" TẠO REPOSITORY GITHUB THÀNH CÔNG! ",
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
console.log("");
|
|
330
|
+
console.log(boxTop(title, border));
|
|
331
|
+
console.log(boxRow("", border));
|
|
332
|
+
|
|
333
|
+
const visibilityPill = repo.isPrivate
|
|
334
|
+
? chalk.bgHex("#7F1D1D").hex("#FCA5A5").bold(" PRIVATE ")
|
|
335
|
+
: chalk.bgHex("#065F46").hex("#6EE7B7").bold(" PUBLIC ");
|
|
336
|
+
|
|
337
|
+
console.log(boxKvDot("Tên Repo", chalk.hex("#F8FAFC").bold(repo.fullName || repo.name), 14, border));
|
|
338
|
+
console.log(boxKvDot("Quyền riêng tư", visibilityPill, 14, border));
|
|
339
|
+
if (repo.description) {
|
|
340
|
+
console.log(boxKvDot("Mô tả", chalk.hex("#CBD5E1")(truncateVisual(repo.description, 42)), 14, border));
|
|
341
|
+
}
|
|
342
|
+
console.log(boxKvDot("HTTPS Clone", chalk.hex("#38BDF8").underline(repo.cloneUrl), 14, border));
|
|
343
|
+
console.log(boxKvDot("SSH Clone", chalk.hex("#A78BFA")(repo.sshUrl), 14, border));
|
|
344
|
+
|
|
345
|
+
console.log(boxRow("", border));
|
|
346
|
+
console.log(boxDivider(border));
|
|
347
|
+
console.log(boxRow(chalk.hex("#6EE7B7")(`» Xem trên GitHub: ${repo.htmlUrl}`), border));
|
|
348
|
+
console.log(boxBottom(border));
|
|
349
|
+
console.log("");
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Cảnh báo Folder lồng trong Repo cha
|
|
230
354
|
*/
|
|
231
355
|
export function printNestedRepoWarning({ targetDir = "", topLevel = "" } = {}) {
|
|
232
356
|
const border = chalk.hex("#D97706");
|
|
@@ -269,7 +393,7 @@ export function printNestedRepoWarning({ targetDir = "", topLevel = "" } = {}) {
|
|
|
269
393
|
}
|
|
270
394
|
|
|
271
395
|
/**
|
|
272
|
-
* Cảnh báo Secret nhạy cảm
|
|
396
|
+
* Cảnh báo Secret nhạy cảm
|
|
273
397
|
*/
|
|
274
398
|
export function printPrePushSecretWarning({ riskyFiles = [], findings = [] }) {
|
|
275
399
|
const border = chalk.hex("#D97706");
|
|
@@ -294,9 +418,8 @@ export function printPrePushSecretWarning({ riskyFiles = [], findings = [] }) {
|
|
|
294
418
|
boxRow(chalk.bold.hex("#F8FAFC")("File cấu hình nguy cơ:"), border),
|
|
295
419
|
);
|
|
296
420
|
const showFiles = riskyFiles.slice(0, 4);
|
|
297
|
-
showFiles.forEach((f
|
|
298
|
-
const
|
|
299
|
-
const tree = chalk.hex("#64748B")(isLast ? " +- " : " +- ");
|
|
421
|
+
showFiles.forEach((f) => {
|
|
422
|
+
const tree = chalk.hex("#64748B")(" +- ");
|
|
300
423
|
console.log(
|
|
301
424
|
boxRow(tree + chalk.hex("#FCD34D")(truncateVisual(f, 46)), border),
|
|
302
425
|
);
|
|
@@ -322,7 +445,7 @@ export function printPrePushSecretWarning({ riskyFiles = [], findings = [] }) {
|
|
|
322
445
|
const showFindings = findings.slice(0, 4);
|
|
323
446
|
showFindings.forEach((f, idx) => {
|
|
324
447
|
const isLast = idx === showFindings.length - 1;
|
|
325
|
-
const tree = chalk.hex("#64748B")(
|
|
448
|
+
const tree = chalk.hex("#64748B")(" +- ");
|
|
326
449
|
const loc = truncateVisual(`${f.file}:${f.line}`, 26);
|
|
327
450
|
console.log(
|
|
328
451
|
boxRow(
|
|
@@ -356,7 +479,7 @@ export function printPrePushSecretWarning({ riskyFiles = [], findings = [] }) {
|
|
|
356
479
|
console.log(
|
|
357
480
|
boxRow(
|
|
358
481
|
chalk.hex("#34D399")(
|
|
359
|
-
'Gợi ý: Chọn "Tự động fix" để gỡ file + .gitignore',
|
|
482
|
+
'Gợi ý: Chọn "Tự động fix" để gỡ file + .gitignore an toàn',
|
|
360
483
|
),
|
|
361
484
|
border,
|
|
362
485
|
),
|
|
@@ -365,7 +488,7 @@ export function printPrePushSecretWarning({ riskyFiles = [], findings = [] }) {
|
|
|
365
488
|
}
|
|
366
489
|
|
|
367
490
|
/**
|
|
368
|
-
* Cảnh báo Push bị chặn bởi GitHub Push Protection
|
|
491
|
+
* Cảnh báo Push bị chặn bởi GitHub Push Protection (GH013)
|
|
369
492
|
*/
|
|
370
493
|
export function printSecretBlockedBox(rawMessage, details = {}) {
|
|
371
494
|
const border = chalk.hex("#E11D48");
|
|
@@ -418,7 +541,7 @@ export function printSecretBlockedBox(rawMessage, details = {}) {
|
|
|
418
541
|
console.log(
|
|
419
542
|
boxRow(
|
|
420
543
|
chalk.hex("#38BDF8")(
|
|
421
|
-
" [2]
|
|
544
|
+
" [2] Dùng tool tự động gỡ file & squash làm sạch commit",
|
|
422
545
|
),
|
|
423
546
|
border,
|
|
424
547
|
),
|
|
@@ -431,12 +554,6 @@ export function printSecretBlockedBox(rawMessage, details = {}) {
|
|
|
431
554
|
border,
|
|
432
555
|
),
|
|
433
556
|
);
|
|
434
|
-
console.log(
|
|
435
|
-
boxRow(
|
|
436
|
-
chalk.hex("#94A3B8")(" [4] Sau đó chạy lại tool để đẩy code lên"),
|
|
437
|
-
border,
|
|
438
|
-
),
|
|
439
|
-
);
|
|
440
557
|
|
|
441
558
|
console.log(boxBottom(border));
|
|
442
559
|
|
|
@@ -455,7 +572,7 @@ export function printSecretBlockedBox(rawMessage, details = {}) {
|
|
|
455
572
|
}
|
|
456
573
|
|
|
457
574
|
/**
|
|
458
|
-
* Card Thông báo Thành công
|
|
575
|
+
* Card Thông báo Thành công sau khi Push
|
|
459
576
|
*/
|
|
460
577
|
export function printSuccessBox({ branch, repoUrl }) {
|
|
461
578
|
const border = chalk.hex("#059669");
|
|
@@ -484,7 +601,7 @@ export function printSuccessBox({ branch, repoUrl }) {
|
|
|
484
601
|
console.log(boxRow("", border));
|
|
485
602
|
console.log(
|
|
486
603
|
boxRow(
|
|
487
|
-
chalk.hex("#64748B")("»
|
|
604
|
+
chalk.hex("#64748B")("» Xem lịch sử commit: git log -1 --stat"),
|
|
488
605
|
border,
|
|
489
606
|
),
|
|
490
607
|
);
|
|
@@ -545,7 +662,7 @@ export function printGitMissing() {
|
|
|
545
662
|
printErrorBox(
|
|
546
663
|
"CHƯA CÀI ĐẶT GIT",
|
|
547
664
|
[
|
|
548
|
-
"Không tìm thấy Git trên hệ thống.",
|
|
665
|
+
"Không tìm thấy Git trên hệ thống máy tính của bạn.",
|
|
549
666
|
"Vui lòng tải và cài đặt Git để tiếp tục!",
|
|
550
667
|
],
|
|
551
668
|
"Tải ngay tại: https://git-scm.com/downloads",
|
|
@@ -584,19 +701,19 @@ export function printAuthFailedBox(message = "") {
|
|
|
584
701
|
);
|
|
585
702
|
console.log(
|
|
586
703
|
boxRow(
|
|
587
|
-
chalk.hex("#E2E8F0")(" [1]
|
|
704
|
+
chalk.hex("#E2E8F0")(" [1] Chạy tính năng GITHUB trong tool để kết nối tài khoản"),
|
|
588
705
|
border,
|
|
589
706
|
),
|
|
590
707
|
);
|
|
591
708
|
console.log(
|
|
592
709
|
boxRow(
|
|
593
|
-
chalk.hex("#E2E8F0")(" [2]
|
|
710
|
+
chalk.hex("#E2E8F0")(" [2] Dùng lệnh gh: gh auth login"),
|
|
594
711
|
border,
|
|
595
712
|
),
|
|
596
713
|
);
|
|
597
714
|
console.log(
|
|
598
715
|
boxRow(
|
|
599
|
-
chalk.hex("#94A3B8")(" [3] Sử dụng SSH: git@github.com:user/repo.git"),
|
|
716
|
+
chalk.hex("#94A3B8")(" [3] Sử dụng SSH URL: git@github.com:user/repo.git"),
|
|
600
717
|
border,
|
|
601
718
|
),
|
|
602
719
|
);
|
|
@@ -634,7 +751,7 @@ export function printNonFastForwardBox(message = "", branch = "main") {
|
|
|
634
751
|
console.log(
|
|
635
752
|
boxRow(
|
|
636
753
|
chalk.hex("#38BDF8")(
|
|
637
|
-
` »
|
|
754
|
+
` » Bạn có thể chọn Pull (rebase) rồi push lại ngay trong tool`,
|
|
638
755
|
),
|
|
639
756
|
border,
|
|
640
757
|
),
|
|
@@ -694,13 +811,13 @@ export function printFixResult({
|
|
|
694
811
|
export function printFooter() {
|
|
695
812
|
console.log(chalk.hex("#334155")(" ─── » ───"));
|
|
696
813
|
console.log(
|
|
697
|
-
chalk.hex("#64748B")(" » Mẹo:
|
|
698
|
-
chalk.hex("#38BDF8").bold("git-push-time
|
|
699
|
-
chalk.hex("#64748B")(" để
|
|
814
|
+
chalk.hex("#64748B")(" » Mẹo: Chạy ") +
|
|
815
|
+
chalk.hex("#38BDF8").bold("git-push-time --help") +
|
|
816
|
+
chalk.hex("#64748B")(" để xem toàn bộ danh sách lệnh và phím tắt."),
|
|
700
817
|
);
|
|
701
818
|
console.log(
|
|
702
819
|
chalk.hex("#475569")(
|
|
703
|
-
" »
|
|
820
|
+
" » GitHub CLI & Push Time — Chúc bạn làm việc hiệu quả!\n",
|
|
704
821
|
),
|
|
705
822
|
);
|
|
706
823
|
}
|
|
@@ -716,13 +833,12 @@ export function styleCliHelp(program) {
|
|
|
716
833
|
program.addHelpText(
|
|
717
834
|
"after",
|
|
718
835
|
`
|
|
719
|
-
${chalk.hex("#334155")("─── » Ví dụ
|
|
720
|
-
${chalk.hex("#34D399")("$")} ${chalk.white('git-push-time
|
|
721
|
-
${chalk.hex("#34D399")("$")} ${chalk.white(
|
|
836
|
+
${chalk.hex("#334155")("─── » Ví dụ phổ biến ───")}
|
|
837
|
+
${chalk.hex("#34D399")("$")} ${chalk.white('git-push-time')} # Mở menu điều khiển tương tác trực quan
|
|
838
|
+
${chalk.hex("#34D399")("$")} ${chalk.white('git-push-time github create')} # Tạo nhanh repo mới trên GitHub
|
|
839
|
+
${chalk.hex("#34D399")("$")} ${chalk.white('git-push-time -r <repo-url> -d "-2d" -y')} # Push tự động lùi 2 ngày
|
|
840
|
+
${chalk.hex("#34D399")("$")} ${chalk.white('git-push-time fix')} # Quét & gỡ sạch secret
|
|
841
|
+
${chalk.hex("#34D399")("$")} ${chalk.white('git-push-time pull')} # Cập nhật code mới từ remote
|
|
722
842
|
`,
|
|
723
843
|
);
|
|
724
844
|
}
|
|
725
|
-
|
|
726
|
-
export function line(char = "─") {
|
|
727
|
-
return chalk.hex("#334155")(char.repeat(getW()));
|
|
728
|
-
}
|