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.
- package/.github/workflows/npm-publish.yml +59 -32
- package/README.md +110 -112
- package/bin/index.js +321 -339
- package/lib/commands/edit-time.js +141 -141
- package/lib/commands/fix.js +113 -113
- package/lib/commands/github.js +429 -445
- package/lib/commands/pull.js +90 -90
- package/lib/commands/push.js +720 -720
- package/lib/config.js +220 -220
- package/lib/fix.js +286 -286
- package/lib/git.js +525 -516
- package/lib/github.js +322 -322
- package/lib/prompt-helpers.js +19 -20
- package/lib/secrets.js +92 -92
- package/lib/ui.js +1057 -1063
- package/lib/utils.js +120 -120
- package/package.json +36 -36
|
@@ -1,32 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
with:
|
|
27
|
-
node-version: 20
|
|
28
|
-
registry-url: https://registry.npmjs.org/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
**
|
|
5
|
+
**A terminal toolkit for GitHub sign-in, repository management, push and pull, and secret scanning.**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/git-push-time)
|
|
8
8
|
[](./LICENSE)
|
|
@@ -15,205 +15,203 @@
|
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Features
|
|
19
19
|
|
|
20
|
-
###
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- **
|
|
24
|
-
- **
|
|
25
|
-
-
|
|
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
|
-
###
|
|
28
|
-
- **
|
|
29
|
-
-
|
|
30
|
-
- **Pull
|
|
31
|
-
-
|
|
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
|
-
###
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
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
|
-
###
|
|
39
|
-
- Dashboard
|
|
40
|
-
-
|
|
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
|
-
>
|
|
42
|
+
> Commit timestamp editing (backdating) is an additional utility. See [Commit timestamps](#commit-timestamps).
|
|
43
43
|
|
|
44
44
|
---
|
|
45
45
|
|
|
46
|
-
##
|
|
46
|
+
## Installation
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
#
|
|
49
|
+
# Install globally (recommended)
|
|
50
50
|
npm install -g git-push-time
|
|
51
51
|
|
|
52
|
-
#
|
|
52
|
+
# Or run without installing
|
|
53
53
|
npx git-push-time
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Requirements: **Node.js ≥ 18** and **Git**.
|
|
57
57
|
|
|
58
58
|
---
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
## Quick start
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
# 1.
|
|
63
|
+
# 1. Sign in to GitHub in your browser
|
|
64
64
|
githubcli github login
|
|
65
65
|
|
|
66
|
-
# 2.
|
|
66
|
+
# 2. Create a repository and choose whether to push your project
|
|
67
67
|
githubcli github create
|
|
68
68
|
|
|
69
|
-
# 3.
|
|
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
|
-
|
|
73
|
+
Run `githubcli` without flags to open the interactive wizard:
|
|
74
74
|
|
|
75
75
|
```text
|
|
76
76
|
githubcli
|
|
77
77
|
│
|
|
78
|
-
├── 📁 1.
|
|
79
|
-
├── 👤 2.
|
|
80
|
-
├── 📦 3.
|
|
81
|
-
├── 🌿 4.
|
|
82
|
-
├── 💬 5.
|
|
83
|
-
├── ⏰ 6.
|
|
84
|
-
└── 🚀 7.
|
|
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
|
-
##
|
|
89
|
+
## Terminal preview
|
|
90
90
|
|
|
91
91
|
```text
|
|
92
|
-
╭─────────────── git-push-time v1.1.
|
|
92
|
+
╭─────────────── git-push-time v1.1.2 ───────────────╮
|
|
93
93
|
│ ▲ Folder E:\my-project │
|
|
94
|
-
│ → Branch main ● 5
|
|
95
|
-
│ ◆ GitHub @username ✓
|
|
96
|
-
│ ○ Remote username/my-repo
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
╭──────────────────
|
|
100
|
-
│
|
|
101
|
-
│ Branch
|
|
102
|
-
│ Message
|
|
103
|
-
│ Time
|
|
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
|
-
##
|
|
109
|
+
## Commands
|
|
110
110
|
|
|
111
111
|
### GitHub
|
|
112
112
|
|
|
113
|
-
|
|
|
113
|
+
| Command | Description |
|
|
114
114
|
| :--- | :--- |
|
|
115
|
-
| `githubcli github login` |
|
|
116
|
-
| `githubcli github logout` |
|
|
117
|
-
| `githubcli github whoami` |
|
|
118
|
-
| `githubcli github repos` |
|
|
119
|
-
| `githubcli github create` |
|
|
120
|
-
| `githubcli github` |
|
|
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
|
|
122
|
+
### Push, pull, and security
|
|
123
123
|
|
|
124
|
-
|
|
|
124
|
+
| Command | Description |
|
|
125
125
|
| :--- | :--- |
|
|
126
|
-
| `githubcli` |
|
|
127
|
-
| `githubcli -r <url> -m "<msg>" -b <branch> -y` | Push
|
|
128
|
-
| `githubcli --dir ./my-app -r <url> -m "Init" -y` |
|
|
129
|
-
| `githubcli pull [remote] [branch]` |
|
|
130
|
-
| `githubcli fix` |
|
|
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
|
-
###
|
|
132
|
+
### Push options
|
|
133
133
|
|
|
134
|
-
|
|
|
134
|
+
| Option | Description | Example |
|
|
135
135
|
| :--- | :--- | :--- |
|
|
136
|
-
| `-r, --repo <url>` | URL
|
|
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>` |
|
|
139
|
-
| `-d, --date <time>` |
|
|
140
|
-
| `-C, --dir <path>` |
|
|
141
|
-
| `-f, --force` |
|
|
142
|
-
| `-y, --yes` |
|
|
143
|
-
| `--fix` |
|
|
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
|
-
##
|
|
147
|
+
## Tokens and sign-in
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
Tokens are selected in this order:
|
|
150
150
|
|
|
151
|
-
1.
|
|
152
|
-
2.
|
|
153
|
-
3.
|
|
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
|
-
##
|
|
157
|
+
## Commit timestamps
|
|
158
158
|
|
|
159
159
|
<details>
|
|
160
|
-
<summary><b>
|
|
161
|
-
|
|
162
|
-
<br>
|
|
160
|
+
<summary><b>Backdate a push or edit an existing commit</b></summary>
|
|
163
161
|
|
|
164
|
-
|
|
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
|
-
|
|
169
|
+
To edit a timestamp on an existing commit:
|
|
172
170
|
|
|
173
171
|
```bash
|
|
174
172
|
githubcli edit-time
|
|
175
173
|
```
|
|
176
174
|
|
|
177
|
-
|
|
|
175
|
+
| Format | Meaning |
|
|
178
176
|
| :--- | :--- |
|
|
179
|
-
| `now`
|
|
180
|
-
| `-2d` / `2d` |
|
|
181
|
-
| `-5h` / `5h` |
|
|
182
|
-
| `-30m` / `30m` |
|
|
183
|
-
| `-1w` / `1w` |
|
|
184
|
-
| `-3M` / `-3mo` |
|
|
185
|
-
| `2024-01-15 14:30:00` |
|
|
186
|
-
| `2024-01-15` |
|
|
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
|
-
##
|
|
190
|
+
## Source layout
|
|
193
191
|
|
|
194
|
-
```
|
|
192
|
+
```text
|
|
195
193
|
cli/
|
|
196
194
|
├── bin/
|
|
197
|
-
│ └── index.js #
|
|
195
|
+
│ └── index.js # Entry point and Commander dispatcher
|
|
198
196
|
├── lib/
|
|
199
|
-
│ ├── config.js #
|
|
200
|
-
│ ├── github.js # GitHub REST API
|
|
201
|
-
│ ├── git.js #
|
|
202
|
-
│ ├── secrets.js #
|
|
203
|
-
│ ├── fix.js #
|
|
204
|
-
│ ├── utils.js #
|
|
205
|
-
│ ├── prompt-helpers.js
|
|
206
|
-
│ ├── ui.js #
|
|
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 #
|
|
209
|
-
│ ├── github.js #
|
|
210
|
-
│ ├── pull.js # Pull
|
|
211
|
-
│ ├── edit-time.js #
|
|
212
|
-
│ └── fix.js #
|
|
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
|
-
##
|
|
215
|
+
## License
|
|
218
216
|
|
|
219
|
-
|
|
217
|
+
MIT
|