git-push-time 1.1.3 → 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/README.md +109 -111
- package/bin/index.js +45 -46
- package/lib/commands/edit-time.js +27 -27
- package/lib/commands/fix.js +19 -19
- package/lib/commands/github.js +98 -98
- package/lib/commands/pull.js +13 -13
- package/lib/commands/push.js +147 -147
- package/lib/config.js +17 -17
- package/lib/fix.js +34 -34
- package/lib/git.js +88 -88
- package/lib/github.js +39 -39
- package/lib/prompt-helpers.js +19 -20
- package/lib/secrets.js +12 -12
- package/lib/ui.js +122 -125
- package/lib/utils.js +15 -15
- package/package.json +1 -1
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
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
|
package/bin/index.js
CHANGED
|
@@ -49,7 +49,7 @@ function isExitPromptError(err) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* Check whether the command was invoked without flags or subcommands.
|
|
53
53
|
*/
|
|
54
54
|
function isBareInvocation(options = {}) {
|
|
55
55
|
return (
|
|
@@ -64,41 +64,41 @@ function isBareInvocation(options = {}) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Main menu shown when `git-push-time` is run without flags.
|
|
68
68
|
*/
|
|
69
69
|
async function promptMainMenu() {
|
|
70
70
|
return await selectBox({
|
|
71
|
-
message: '
|
|
72
|
-
hint: '↑↓
|
|
71
|
+
message: 'Main dashboard',
|
|
72
|
+
hint: '↑↓ move · Enter select · Esc exit',
|
|
73
73
|
pageSize: 10,
|
|
74
74
|
choices: [
|
|
75
75
|
{
|
|
76
|
-
name: `${chalk.hex('#38BDF8').bold('PUSH')} ${chalk.hex('#334155')('·')} ${chalk.hex('#F1F5F9')('
|
|
76
|
+
name: `${chalk.hex('#38BDF8').bold('PUSH')} ${chalk.hex('#334155')('·')} ${chalk.hex('#F1F5F9')('Push a project to a repository')}`,
|
|
77
77
|
value: 'push',
|
|
78
|
-
description: '
|
|
78
|
+
description: 'Choose or create a repository, scan for secrets, and push',
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
|
-
name: `${chalk.hex('#A78BFA').bold('GITHUB')} ${chalk.hex('#334155')('·')} ${chalk.hex('#CBD5E1')('
|
|
81
|
+
name: `${chalk.hex('#A78BFA').bold('GITHUB')} ${chalk.hex('#334155')('·')} ${chalk.hex('#CBD5E1')('Accounts and repositories')}`,
|
|
82
82
|
value: 'github',
|
|
83
|
-
description: '
|
|
83
|
+
description: 'Sign in, switch accounts, and browse GitHub repositories',
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
|
-
name: `${chalk.hex('#34D399').bold('PULL')} ${chalk.hex('#334155')('·')} ${chalk.hex('#CBD5E1')('
|
|
86
|
+
name: `${chalk.hex('#34D399').bold('PULL')} ${chalk.hex('#334155')('·')} ${chalk.hex('#CBD5E1')('Get updates from a remote')}`,
|
|
87
87
|
value: 'pull',
|
|
88
|
-
description: 'Pull
|
|
88
|
+
description: 'Pull safely with fast-forward or rebase',
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
|
-
name: `${chalk.hex('#FBBF24').bold('EDIT TIME')} ${chalk.hex('#334155')('·')} ${chalk.hex('#CBD5E1')('
|
|
91
|
+
name: `${chalk.hex('#FBBF24').bold('EDIT TIME')} ${chalk.hex('#334155')('·')} ${chalk.hex('#CBD5E1')('Change a commit timestamp')}`,
|
|
92
92
|
value: 'edit-time',
|
|
93
|
-
description: '
|
|
93
|
+
description: 'Rewrite the timestamp of an existing commit',
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
|
-
name: `${chalk.hex('#F43F5E').bold('SECURITY')} ${chalk.hex('#334155')('·')} ${chalk.hex('#CBD5E1')('
|
|
96
|
+
name: `${chalk.hex('#F43F5E').bold('SECURITY')} ${chalk.hex('#334155')('·')} ${chalk.hex('#CBD5E1')('Scan for secrets')}`,
|
|
97
97
|
value: 'fix',
|
|
98
|
-
description: '
|
|
98
|
+
description: 'Scan for secrets, unstage them, and update .gitignore',
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
|
-
name: `${chalk.hex('#64748B').bold('
|
|
101
|
+
name: `${chalk.hex('#64748B').bold('EXIT')} ${chalk.hex('#334155')('·')} ${chalk.hex('#64748B')('Close the program')}`,
|
|
102
102
|
value: 'exit',
|
|
103
103
|
},
|
|
104
104
|
],
|
|
@@ -106,7 +106,7 @@ async function promptMainMenu() {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
109
|
+
* Main menu loop; back callbacks return a sentinel instead of recursing.
|
|
110
110
|
*/
|
|
111
111
|
async function runMainMenuLoop(initialOptions = {}) {
|
|
112
112
|
while (true) {
|
|
@@ -151,7 +151,7 @@ async function runMainMenuLoop(initialOptions = {}) {
|
|
|
151
151
|
try {
|
|
152
152
|
if (action === 'push') {
|
|
153
153
|
const res = await runPushWizard(initialOptions, async () => 'back');
|
|
154
|
-
// 'back'
|
|
154
|
+
// 'back' returns to the dashboard; otherwise the completed push exits.
|
|
155
155
|
if (res === 'back') continue;
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
@@ -173,8 +173,7 @@ async function runMainMenuLoop(initialOptions = {}) {
|
|
|
173
173
|
throw err;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
//
|
|
177
|
-
// "tiếp tục / quay lại" sau menu hành động.
|
|
176
|
+
// Each action returns to the dashboard, so no extra continue/back prompt is needed.
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
179
|
|
|
@@ -201,7 +200,7 @@ async function main(options = {}) {
|
|
|
201
200
|
return;
|
|
202
201
|
}
|
|
203
202
|
|
|
204
|
-
//
|
|
203
|
+
// Run the push wizard directly with the supplied options.
|
|
205
204
|
try {
|
|
206
205
|
await runPushWizard(options);
|
|
207
206
|
} catch (err) {
|
|
@@ -222,24 +221,24 @@ styleCliHelp(program);
|
|
|
222
221
|
|
|
223
222
|
program
|
|
224
223
|
.name('git-push-time')
|
|
225
|
-
.description('
|
|
224
|
+
.description('Git and GitHub CLI for pushing, repository management, commit timestamps, and secret protection')
|
|
226
225
|
.version(VERSION)
|
|
227
|
-
.option('-r, --repo <url>', '
|
|
228
|
-
.option('-d, --date <datetime>', '
|
|
229
|
-
.option('-m, --message <msg>', '
|
|
230
|
-
.option('-b, --branch <branch>', '
|
|
231
|
-
.option('-C, --dir <path>', '
|
|
232
|
-
.option('-f, --force', '
|
|
233
|
-
.option('-y, --yes', '
|
|
234
|
-
.option('--fix', '
|
|
226
|
+
.option('-r, --repo <url>', 'Git repository URL, or leave empty to choose or create one')
|
|
227
|
+
.option('-d, --date <datetime>', 'Commit time (e.g. "2024-01-15 14:30:00", "-2d", "-5h", "now")')
|
|
228
|
+
.option('-m, --message <msg>', 'Commit message')
|
|
229
|
+
.option('-b, --branch <branch>', 'Remote branch name (default: main)')
|
|
230
|
+
.option('-C, --dir <path>', 'Source folder to push (default: current folder)')
|
|
231
|
+
.option('-f, --force', 'Force push (--force)', false)
|
|
232
|
+
.option('-y, --yes', 'Skip prompts and use the provided values or defaults', false)
|
|
233
|
+
.option('--fix', 'Unstage secret files and update .gitignore (keeps local files)', false)
|
|
235
234
|
.action(async (opts) => {
|
|
236
235
|
await main(opts);
|
|
237
236
|
});
|
|
238
237
|
|
|
239
|
-
//
|
|
238
|
+
// GITHUB COMMANDS
|
|
240
239
|
const ghCmd = program
|
|
241
240
|
.command('github')
|
|
242
|
-
.description('
|
|
241
|
+
.description('Manage GitHub accounts and repositories')
|
|
243
242
|
.action(async () => {
|
|
244
243
|
printBanner(VERSION);
|
|
245
244
|
await runGitHubMenu();
|
|
@@ -247,8 +246,8 @@ const ghCmd = program
|
|
|
247
246
|
|
|
248
247
|
ghCmd
|
|
249
248
|
.command('create')
|
|
250
|
-
.description('
|
|
251
|
-
.option('-C, --dir <path>', '
|
|
249
|
+
.description('Create a GitHub repository (public or private)')
|
|
250
|
+
.option('-C, --dir <path>', 'Source folder used to suggest a repository name')
|
|
252
251
|
.action(async (opts) => {
|
|
253
252
|
printBanner(VERSION);
|
|
254
253
|
const res = await promptCreateRepo({ targetDir: opts.dir || process.cwd() });
|
|
@@ -259,7 +258,7 @@ ghCmd
|
|
|
259
258
|
|
|
260
259
|
ghCmd
|
|
261
260
|
.command('whoami')
|
|
262
|
-
.description('
|
|
261
|
+
.description('Show the connected GitHub account')
|
|
263
262
|
.action(async () => {
|
|
264
263
|
printBanner(VERSION);
|
|
265
264
|
await showGitHubStatus();
|
|
@@ -267,7 +266,7 @@ ghCmd
|
|
|
267
266
|
|
|
268
267
|
ghCmd
|
|
269
268
|
.command('repos')
|
|
270
|
-
.description('
|
|
269
|
+
.description('List your GitHub repositories')
|
|
271
270
|
.action(async () => {
|
|
272
271
|
printBanner(VERSION);
|
|
273
272
|
await showUserRepos();
|
|
@@ -275,7 +274,7 @@ ghCmd
|
|
|
275
274
|
|
|
276
275
|
ghCmd
|
|
277
276
|
.command('login')
|
|
278
|
-
.description('
|
|
277
|
+
.description('Sign in to GitHub with OAuth Device Flow or a token')
|
|
279
278
|
.action(async () => {
|
|
280
279
|
printBanner(VERSION);
|
|
281
280
|
await promptGitHubLogin();
|
|
@@ -283,37 +282,37 @@ ghCmd
|
|
|
283
282
|
|
|
284
283
|
ghCmd
|
|
285
284
|
.command('logout')
|
|
286
|
-
.description('
|
|
285
|
+
.description('Sign out of GitHub on this machine')
|
|
287
286
|
.action(async () => {
|
|
288
287
|
printBanner(VERSION);
|
|
289
288
|
logoutGitHub();
|
|
290
289
|
});
|
|
291
290
|
|
|
292
|
-
//
|
|
291
|
+
// FIX COMMAND
|
|
293
292
|
program
|
|
294
293
|
.command('fix')
|
|
295
|
-
.description('
|
|
296
|
-
.option('-C, --dir <path>', '
|
|
294
|
+
.description('Scan for secrets, unstage files, update .gitignore, and clean unpushed commits')
|
|
295
|
+
.option('-C, --dir <path>', 'Folder to scan (default: current folder)')
|
|
297
296
|
.action(async (opts) => {
|
|
298
297
|
printBanner(VERSION);
|
|
299
298
|
await runFixCommand(opts);
|
|
300
299
|
});
|
|
301
300
|
|
|
302
|
-
//
|
|
301
|
+
// PULL COMMAND
|
|
303
302
|
program
|
|
304
303
|
.command('pull [remote] [branch]')
|
|
305
|
-
.description('
|
|
306
|
-
.option('-C, --dir <path>', '
|
|
304
|
+
.description('Pull from a remote with fast-forward (--ff-only) or rebase')
|
|
305
|
+
.option('-C, --dir <path>', 'Repository folder (default: current folder)')
|
|
307
306
|
.action(async (remote, branch, opts) => {
|
|
308
307
|
printBanner(VERSION);
|
|
309
308
|
await runPullCommand(remote || 'origin', branch, opts || {});
|
|
310
309
|
});
|
|
311
310
|
|
|
312
|
-
//
|
|
311
|
+
// EDIT-TIME COMMAND
|
|
313
312
|
program
|
|
314
313
|
.command('edit-time')
|
|
315
|
-
.description('
|
|
316
|
-
.option('-C, --dir <path>', '
|
|
314
|
+
.description('Change the timestamp of an existing commit')
|
|
315
|
+
.option('-C, --dir <path>', 'Repository folder (default: current folder)')
|
|
317
316
|
.action(async (opts) => {
|
|
318
317
|
printBanner(VERSION);
|
|
319
318
|
await runEditCommitTimeCommand(opts);
|