git-push-time 1.1.2 → 1.1.4

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.
@@ -1,32 +1,59 @@
1
-
2
-
3
- name: Node.js Package
4
-
5
- on:
6
- release:
7
- types: [created]
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v4
14
- - uses: actions/setup-node@v4
15
- with:
16
- node-version: 20
17
- - run: npm ci
18
- - run: npm test
19
-
20
- publish-npm:
21
- needs: build
22
- runs-on: ubuntu-latest
23
- steps:
24
- - uses: actions/checkout@v4
25
- - uses: actions/setup-node@v4
26
- with:
27
- node-version: 20
28
- registry-url: https://registry.npmjs.org/
29
- - run: npm ci
30
- - run: npm publish
31
- env:
32
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ concurrency:
12
+ group: npm-publish-master
13
+ cancel-in-progress: false
14
+
15
+ jobs:
16
+ publish:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Check out repository
20
+ uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0
23
+
24
+ - name: Set up Node.js
25
+ uses: actions/setup-node@v4
26
+ with:
27
+ node-version: 20
28
+ registry-url: https://registry.npmjs.org/
29
+
30
+ # Earlier queued runs may have checked out a commit from before the
31
+ # previous publish job's version bump. Rebase before changing versions.
32
+ - name: Sync with master
33
+ run: |
34
+ git fetch origin master
35
+ git rebase origin/master
36
+
37
+ - name: Install dependencies and validate package
38
+ run: |
39
+ npm ci
40
+ npm pack --dry-run
41
+
42
+ - name: Increment patch version
43
+ id: version
44
+ run: |
45
+ npm version patch --no-git-tag-version
46
+ node -e 'const fs = require("node:fs"); fs.appendFileSync(process.env.GITHUB_OUTPUT, `version=${require("./package.json").version}\n`);'
47
+
48
+ - name: Publish package
49
+ run: npm publish
50
+ env:
51
+ NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
52
+
53
+ - name: Save published version to master
54
+ run: |
55
+ git config user.name "github-actions[bot]"
56
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
57
+ git add package.json package-lock.json
58
+ git commit -m "chore: release v${{ steps.version.outputs.version }} [skip ci]"
59
+ git push origin HEAD:master
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # 🐙 GitHub CLI (`githubcli`)
4
4
 
5
- **Trợ lý GitHub trên terminal — đăng nhập, tạo repo, push/pull, quét secret — tất cả trong một chỗ.**
5
+ **A terminal toolkit for GitHub sign-in, repository management, push and pull, and secret scanning.**
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/git-push-time?style=flat-square&color=818CF8)](https://www.npmjs.com/package/git-push-time)
8
8
  [![license](https://img.shields.io/npm/l/git-push-time?style=flat-square)](./LICENSE)
@@ -15,205 +15,203 @@
15
15
 
16
16
  ---
17
17
 
18
- ## ✨ Tính năng
18
+ ## Features
19
19
 
20
- ### 🐙 GitHub — trọng tâm chính
21
- - **Đăng nhập linh hoạt**: OAuth Device Flow (mở trình duyệt, nhập mã) hoặc dán Personal Access Token.
22
- - **Đa tài khoản**: lưu nhiều account, chuyển qua lại, tự nhận token từ `gh CLI` hoặc biến môi trường `GITHUB_TOKEN` / `GH_TOKEN`.
23
- - **Tạo repository ngay trên terminal**: Public / Private, tự gợi ý tên theo folder, tạo xong hỏi đẩy code lên luôn.
24
- - **Quản lý nhanh**: xem profile (`whoami`), duyệt repo cá nhân (`repos`), chọn repo từ danh sách không cần copy-paste URL.
25
- - Token lưu local (`~/.git-push-time/config.json`, chmod 600).
20
+ ### GitHub
21
+ - **Flexible sign-in**: OAuth Device Flow in your browser or a Personal Access Token.
22
+ - **Multiple accounts**: switch between accounts and detect tokens from `gh CLI`, `GITHUB_TOKEN`, or `GH_TOKEN`.
23
+ - **Create repositories in the terminal**: choose public or private visibility, use a suggested folder name, then push your project.
24
+ - **Quick access**: view your profile (`whoami`), browse repositories (`repos`), or select a repository from the list.
25
+ - Tokens are stored locally in `~/.git-push-time/config.json` with restricted file permissions where supported.
26
26
 
27
- ### 🚀 Push / Pull
28
- - **Push wizard 7 bước**: chọn folder → account → repository (chọn sẵn / tạo mới / dán URL) → branch → message → time → xác nhận & push.
29
- - Tự động `git init`, `remote`, `add`, `commit`, `push`; hỗ trợ `--dir`, `--force`, `-y` chạy không hỏi.
30
- - **Pull**: `pull` fast-forward, gợi ý `--rebase` khi lệch lịch sử.
31
- - Nút `« Quay lại` mọi bước (hoặc gõ `..`).
27
+ ### Push and pull
28
+ - **Seven-step push wizard**: choose a folder, account, repository, branch, commit message, and commit time, then review and push.
29
+ - Can run `git init`, configure a remote, stage, commit, and push. Supports `--dir`, `--force`, and `-y`.
30
+ - **Pull** with fast-forward by default; offers rebase when histories have diverged.
31
+ - Go back from prompts with `..` or the Back option.
32
32
 
33
- ### 🛡️ Secret Shield (chống lộ key, lỗi GH013)
34
- - Quét file nhạy cảm (`.env`, `.npmrc`, private keys, API keys) trước khi push.
35
- - Tự gỡ khỏi stage + thêm `.gitignore` (file trên máy vẫn giữ nguyên).
36
- - Gợi ý squash các commit unpushed dính secret.
33
+ ### Secret protection
34
+ - Scan staged files for sensitive files and common API keys before pushing.
35
+ - Unstage detected files and add ignore rules while keeping local files intact.
36
+ - Suggest squashing unpushed commits that may contain secrets.
37
37
 
38
- ### 🎨 Terminal UI
39
- - Dashboard hiển thị folder, branch, trạng thái GitHub, remote.
40
- - Khung bo tròn đồng bộ, căn đều 2 bên, màu Cyberpunk / DevTools.
38
+ ### Terminal interface
39
+ - Dashboard shows the folder, branch, GitHub account, remote, and latest commit.
40
+ - Consistent rounded panels and a dark developer-tool color palette.
41
41
 
42
- > ⏰ *Đổi thời gian commit (backdate / edit-time) chỉ là tiện ích bổ sung, xem ở [Phụ lục](#-phụ-lục-tiện-ích-thời-gian-commit).*
42
+ > Commit timestamp editing (backdating) is an additional utility. See [Commit timestamps](#commit-timestamps).
43
43
 
44
44
  ---
45
45
 
46
- ## 📦 Cài đặt
46
+ ## Installation
47
47
 
48
48
  ```bash
49
- # Cài toàn cục (khuyên dùng) — dùng được ở mọi thư mục
49
+ # Install globally (recommended)
50
50
  npm install -g git-push-time
51
51
 
52
- # Hoặc chạy trực tiếp không cần cài
52
+ # Or run without installing
53
53
  npx git-push-time
54
54
  ```
55
55
 
56
- Yêu cầu: **Node.js ≥ 18** và **Git** đã cài đặt.
56
+ Requirements: **Node.js ≥ 18** and **Git**.
57
57
 
58
58
  ---
59
59
 
60
- ## ⚡ Bắt đầu nhanh (3 bước)
60
+ ## Quick start
61
61
 
62
62
  ```bash
63
- # 1. Đăng nhập GitHub (mở trình duyệt, nhập mã xác nhận)
63
+ # 1. Sign in to GitHub in your browser
64
64
  githubcli github login
65
65
 
66
- # 2. Tạo repo mới (Public/Private), xong chọn đẩy code lên luôn
66
+ # 2. Create a repository and choose whether to push your project
67
67
  githubcli github create
68
68
 
69
- # 3. Hoặc đẩy project hiện tại lên repo bất kỳ
69
+ # 3. Or push the current project to an existing repository
70
70
  githubcli -r https://github.com/username/my-repo.git -m "Initial commit" -b main -y
71
71
  ```
72
72
 
73
- Luồng wizard khi chạy tay `githubcli` (không kèm flag):
73
+ Run `githubcli` without flags to open the interactive wizard:
74
74
 
75
75
  ```text
76
76
  githubcli
77
77
  │
78
- ├── 📁 1. Chọn folder project
79
- ├── 👤 2. Chọn GitHub account
80
- ├── 📦 3. Chọn repository (có sẵn / tạo mới / dán URL)
81
- ├── 🌿 4. Chọn branch
82
- ├── 💬 5. Nhập commit message
83
- ├── ⏰ 6. Chọn commit time (mặc định: ngay bây giờ)
84
- └── 🚀 7. Xác nhận & Push (quét secret → commit → push)
78
+ ├── 📁 1. Choose a project folder
79
+ ├── 👤 2. Choose a GitHub account
80
+ ├── 📦 3. Choose a repository (existing / new / URL)
81
+ ├── 🌿 4. Choose a branch
82
+ ├── 💬 5. Enter a commit message
83
+ ├── ⏰ 6. Choose a commit time (defaults to now)
84
+ └── 🚀 7. Review and push (scan secrets → commit → push)
85
85
  ```
86
86
 
87
87
  ---
88
88
 
89
- ## 🖥️ Giao diện
89
+ ## Terminal preview
90
90
 
91
91
  ```text
92
- ╭─────────────── git-push-time v1.1.1 ───────────────╮
92
+ ╭─────────────── git-push-time v1.1.2 ───────────────╮
93
93
  │ ▲ Folder E:\my-project │
94
- │ → Branch main ● 5 file thay đổi │
95
- │ ◆ GitHub @username ✓ đã đăng nhập │
96
- │ ○ Remote username/my-repo │
97
- ╰─────────────────────────────────────────────────────╯
98
-
99
- ╭────────────────── Xác nhận ───────────────────────╮
100
- │ Repo username/my-repo │
101
- │ Branch main │
102
- │ Message "Initial commit" │
103
- │ Time now │
104
- ╰─────────────────────────────────────────────────────╯
94
+ │ → Branch main ● 5 changes │
95
+ │ ◆ GitHub @username ✓ connected │
96
+ │ ○ Remote username/my-repo │
97
+ ╰──────────────────────────────────────────────────────╯
98
+
99
+ ╭────────────────── Review push ─────────────────────╮
100
+ │ Repository username/my-repo │
101
+ │ Branch main │
102
+ │ Message "Initial commit" │
103
+ │ Time now │
104
+ ╰──────────────────────────────────────────────────────╯
105
105
  ```
106
106
 
107
107
  ---
108
108
 
109
- ## 🛠️ Lệnh
109
+ ## Commands
110
110
 
111
111
  ### GitHub
112
112
 
113
- | Lệnh | Mô tả |
113
+ | Command | Description |
114
114
  | :--- | :--- |
115
- | `githubcli github login` | Đăng nhập (OAuth Device Flow hoặc PAT — token cần quyền `repo`) |
116
- | `githubcli github logout` | Đăng xuất, xóa token khỏi máy |
117
- | `githubcli github whoami` | Xem profile tài khoản đang kết nối |
118
- | `githubcli github repos` | Liệt kê repository cá nhân |
119
- | `githubcli github create` | Tạo repo mới, hỏi đẩy code lên ngay |
120
- | `githubcli github` | Mở menu quản lý GitHub tương tác |
115
+ | `githubcli github login` | Sign in with OAuth Device Flow or a PAT (requires the `repo` scope) |
116
+ | `githubcli github logout` | Sign out and remove the saved token |
117
+ | `githubcli github whoami` | Show the connected GitHub account |
118
+ | `githubcli github repos` | List your GitHub repositories |
119
+ | `githubcli github create` | Create a repository and optionally push your project |
120
+ | `githubcli github` | Open the GitHub account and repository menu |
121
121
 
122
- ### Push / Pull / Fix
122
+ ### Push, pull, and security
123
123
 
124
- | Lệnh | Mô tả |
124
+ | Command | Description |
125
125
  | :--- | :--- |
126
- | `githubcli` | Mở dashboard tương tác (Push / GitHub / Pull / Time / Fix) |
127
- | `githubcli -r <url> -m "<msg>" -b <branch> -y` | Push nhanh không hỏi lại |
128
- | `githubcli --dir ./my-app -r <url> -m "Init" -y` | Chỉ push 1 thư mục con |
129
- | `githubcli pull [remote] [branch]` | Kéo code mới (fast-forward, gợi ý `--rebase` khi cần) |
130
- | `githubcli fix` | Quét & gỡ secret, cập nhật `.gitignore`, làm sạch commit unpushed |
126
+ | `githubcli` | Open the interactive dashboard |
127
+ | `githubcli -r <url> -m "<msg>" -b <branch> -y` | Push without interactive prompts |
128
+ | `githubcli --dir ./my-app -r <url> -m "Init" -y` | Push a subfolder only |
129
+ | `githubcli pull [remote] [branch]` | Pull changes with fast-forward; offers rebase when needed |
130
+ | `githubcli fix` | Scan for secrets, update `.gitignore`, and clean unpushed commits |
131
131
 
132
- ### Flags khi push
132
+ ### Push options
133
133
 
134
- | Flag | Ý nghĩa | Ví dụ |
134
+ | Option | Description | Example |
135
135
  | :--- | :--- | :--- |
136
- | `-r, --repo <url>` | URL repository | `-r https://github.com/user/repo.git` |
136
+ | `-r, --repo <url>` | Repository URL | `-r https://github.com/user/repo.git` |
137
137
  | `-m, --message <msg>` | Commit message | `-m "Add login"` |
138
- | `-b, --branch <branch>` | Branch remote (mặc định `main`) | `-b dev` |
139
- | `-d, --date <time>` | Thời gian commit (mặc định `now`) | `-d "-2d"` |
140
- | `-C, --dir <path>` | Thư mục nguồn | `--dir ./my-app` |
141
- | `-f, --force` | Push đè (`--force`) | — |
142
- | `-y, --yes` | Bỏ qua hỏi, dùng tham số/mặc định | — |
143
- | `--fix` | Tự gỡ secret trước khi commit | — |
138
+ | `-b, --branch <branch>` | Remote branch (default: `main`) | `-b dev` |
139
+ | `-d, --date <time>` | Commit timestamp (default: `now`) | `-d "-2d"` |
140
+ | `-C, --dir <path>` | Source folder | `--dir ./my-app` |
141
+ | `-f, --force` | Force push | — |
142
+ | `-y, --yes` | Skip prompts and use provided values or defaults | — |
143
+ | `--fix` | Unstage detected secrets and update `.gitignore` | — |
144
144
 
145
145
  ---
146
146
 
147
- ## 🔑 Token & đăng nhập
147
+ ## Tokens and sign-in
148
148
 
149
- Thứ tự ưu tiên khi lấy token:
149
+ Tokens are selected in this order:
150
150
 
151
- 1. Biến môi trường `GITHUB_TOKEN` hoặc `GH_TOKEN`
152
- 2. Tài khoản active trong `~/.git-push-time/config.json`
153
- 3. Token từ `gh` CLI (`gh auth token`) nếu máy có cài
151
+ 1. `GITHUB_TOKEN` or `GH_TOKEN` environment variable
152
+ 2. Active account in `~/.git-push-time/config.json`
153
+ 3. GitHub CLI token from `gh auth token`, if installed
154
154
 
155
155
  ---
156
156
 
157
- ## ⏳ Phụ lục: tiện ích thời gian commit
157
+ ## Commit timestamps
158
158
 
159
159
  <details>
160
- <summary><b>Mở rộng: backdate khi push & sửa commit cũ</b></summary>
161
-
162
- <br>
160
+ <summary><b>Backdate a push or edit an existing commit</b></summary>
163
161
 
164
- Khi push có thể gắn thời gian tùy chỉnh bằng flag `-d`:
162
+ When pushing, set a custom timestamp with `-d`:
165
163
 
166
164
  ```bash
167
165
  githubcli -r https://github.com/user/repo.git -d "-2d" -m "Initial commit" -y
168
166
  githubcli -r https://github.com/user/repo.git -d "2024-01-15 14:30:00" -m "Add core" -y
169
167
  ```
170
168
 
171
- Sửa thời gian commit đã có trong lịch sử:
169
+ To edit a timestamp on an existing commit:
172
170
 
173
171
  ```bash
174
172
  githubcli edit-time
175
173
  ```
176
174
 
177
- | Định dạng | Ý nghĩa |
175
+ | Format | Meaning |
178
176
  | :--- | :--- |
179
- | `now` / để trống | Giờ hiện tại |
180
- | `-2d` / `2d` | Lùi 2 ngày |
181
- | `-5h` / `5h` | Lùi 5 giờ |
182
- | `-30m` / `30m` | Lùi 30 phút (`m` = minute) |
183
- | `-1w` / `1w` | Lùi 1 tuần |
184
- | `-3M` / `-3mo` | Lùi 3 tháng (`M` = month) |
185
- | `2024-01-15 14:30:00` | Ngày giờ cụ thể |
186
- | `2024-01-15` | Ngày cụ thể |
177
+ | `now` or blank | Current time |
178
+ | `-2d` / `2d` | Two days ago |
179
+ | `-5h` / `5h` | Five hours ago |
180
+ | `-30m` / `30m` | Thirty minutes ago (`m` = minute) |
181
+ | `-1w` / `1w` | One week ago |
182
+ | `-3M` / `-3mo` | Three months ago (`M` = month) |
183
+ | `2024-01-15 14:30:00` | Specific date and time |
184
+ | `2024-01-15` | Specific date |
187
185
 
188
186
  </details>
189
187
 
190
188
  ---
191
189
 
192
- ## 🏛️ Cấu trúc mã nguồn
190
+ ## Source layout
193
191
 
194
- ```
192
+ ```text
195
193
  cli/
196
194
  ├── bin/
197
- │ └── index.js # Entrypoint & Commander dispatcher
195
+ │ └── index.js # Entry point and Commander dispatcher
198
196
  ├── lib/
199
- │ ├── config.js # Config & token GitHub local
200
- │ ├── github.js # GitHub REST API (verify, repos, create)
201
- │ ├── git.js # Tác vụ Git cốt lõi
202
- │ ├── secrets.js # Quét secret trong stage
203
- │ ├── fix.js # Gỡ secret & squash unpushed
204
- │ ├── utils.js # Validate URL & parse datetime
205
- │ ├── prompt-helpers.js # Prompt trong khung (Back '..')
206
- │ ├── ui.js # Design system: Banner, Box, Dashboard
197
+ │ ├── config.js # Local GitHub account and token configuration
198
+ │ ├── github.js # GitHub REST API helpers
199
+ │ ├── git.js # Core Git operations
200
+ │ ├── secrets.js # Staged secret scanning
201
+ │ ├── fix.js # Unstage secrets and squash unpushed commits
202
+ │ ├── utils.js # URL validation and datetime parsing
203
+ │ ├── prompt-helpers.js # Interactive prompts and back navigation
204
+ │ ├── ui.js # Banner, panels, and dashboard
207
205
  │ └── commands/
208
- │ ├── push.js # Wizard push tích hợp GitHub
209
- │ ├── github.js # Menu & lệnh GitHub
210
- │ ├── pull.js # Pull (--ff-only / --rebase)
211
- │ ├── edit-time.js # Sửa thời gian commit
212
- │ └── fix.js # Quét & sửa secret
206
+ │ ├── push.js # Push wizard
207
+ │ ├── github.js # GitHub menu and commands
208
+ │ ├── pull.js # Pull with fast-forward or rebase
209
+ │ ├── edit-time.js # Edit commit timestamps
210
+ │ └── fix.js # Scan and remediate secrets
213
211
  ```
214
212
 
215
213
  ---
216
214
 
217
- ## 📄 License
215
+ ## License
218
216
 
219
- Phát hành theo giấy phép **MIT**.
217
+ MIT