gh-setup-git-identity 0.4.0 → 0.4.2
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/CHANGELOG.md +22 -0
- package/README.md +12 -9
- package/package.json +1 -1
- package/src/cli.js +11 -16
- package/src/index.js +6 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# gh-setup-git-identity
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 72d4185: Improve output formatting with better organization and verification commands
|
|
8
|
+
|
|
9
|
+
- Added blank lines between major sections for better visual grouping
|
|
10
|
+
- Applied consistent indentation (2 spaces) to detail lines under section headers
|
|
11
|
+
- Added helpful verification commands suggestion at the end of output
|
|
12
|
+
- Updated README.md to reflect the new output format
|
|
13
|
+
- Makes output more readable and professional while providing actionable next steps
|
|
14
|
+
|
|
15
|
+
## 0.4.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 43e1c63: Reduce excessive blank lines in console output
|
|
20
|
+
|
|
21
|
+
- Removed unnecessary blank lines in CLI output to make it more concise
|
|
22
|
+
- Improved readability by minimizing spacing while maintaining logical separation
|
|
23
|
+
- Fixed issue where authentication and configuration messages had too much whitespace
|
|
24
|
+
|
|
3
25
|
## 0.4.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -117,20 +117,23 @@ printf "y" | gh auth login -h github.com -s repo,workflow,user,read:org,gist --g
|
|
|
117
117
|
|
|
118
118
|
```
|
|
119
119
|
Fetching GitHub user information...
|
|
120
|
-
GitHub user: your-username
|
|
121
|
-
GitHub email: your-email@example.com
|
|
120
|
+
GitHub user: your-username
|
|
121
|
+
GitHub email: your-email@example.com
|
|
122
122
|
|
|
123
123
|
Configuring git (global)...
|
|
124
|
-
Git identity configured successfully!
|
|
124
|
+
Git identity configured successfully!
|
|
125
125
|
|
|
126
|
-
Git configured:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
Scope: global (--global)
|
|
126
|
+
Git configured:
|
|
127
|
+
user.name: your-username
|
|
128
|
+
user.email: your-email@example.com
|
|
129
|
+
Scope: global (--global)
|
|
132
130
|
|
|
133
131
|
Git identity setup complete!
|
|
132
|
+
|
|
133
|
+
You can verify your configuration with:
|
|
134
|
+
gh auth status
|
|
135
|
+
git config --global user.name
|
|
136
|
+
git config --global user.email
|
|
134
137
|
```
|
|
135
138
|
|
|
136
139
|
## Library Usage
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -66,9 +66,7 @@ async function main() {
|
|
|
66
66
|
const authenticated = await isGhAuthenticated({ verbose: config.verbose });
|
|
67
67
|
|
|
68
68
|
if (!authenticated) {
|
|
69
|
-
console.log('');
|
|
70
69
|
console.log('GitHub CLI is not authenticated. Starting authentication...');
|
|
71
|
-
console.log('');
|
|
72
70
|
|
|
73
71
|
// Automatically run gh auth login
|
|
74
72
|
const loginSuccess = await runGhAuthLogin({ verbose: config.verbose });
|
|
@@ -76,13 +74,9 @@ async function main() {
|
|
|
76
74
|
if (!loginSuccess) {
|
|
77
75
|
console.log('');
|
|
78
76
|
console.log('Authentication failed. Please try running manually:');
|
|
79
|
-
console.log('');
|
|
80
77
|
console.log(' printf "y" | gh auth login -h github.com -s repo,workflow,user,read:org,gist --git-protocol https --web');
|
|
81
|
-
console.log('');
|
|
82
78
|
process.exit(1);
|
|
83
79
|
}
|
|
84
|
-
|
|
85
|
-
console.log('');
|
|
86
80
|
}
|
|
87
81
|
|
|
88
82
|
// Prepare options
|
|
@@ -94,12 +88,11 @@ async function main() {
|
|
|
94
88
|
|
|
95
89
|
if (options.verbose) {
|
|
96
90
|
console.log('Options:', options);
|
|
97
|
-
console.log('');
|
|
98
91
|
}
|
|
99
92
|
|
|
100
93
|
if (options.dryRun) {
|
|
101
|
-
console.log('DRY MODE - No actual changes will be made');
|
|
102
94
|
console.log('');
|
|
95
|
+
console.log('DRY MODE - No actual changes will be made');
|
|
103
96
|
}
|
|
104
97
|
|
|
105
98
|
// Setup git identity
|
|
@@ -107,16 +100,19 @@ async function main() {
|
|
|
107
100
|
|
|
108
101
|
// Display results
|
|
109
102
|
console.log('');
|
|
110
|
-
console.log(
|
|
111
|
-
console.log(
|
|
112
|
-
console.log(`
|
|
113
|
-
console.log(`
|
|
114
|
-
console.log('');
|
|
115
|
-
console.log(`Scope: ${scope === 'global' ? 'global (--global)' : 'local (--local)'}`);
|
|
116
|
-
console.log('');
|
|
103
|
+
console.log(` ${options.dryRun ? '[DRY MODE] Would configure' : 'Git configured'}:`);
|
|
104
|
+
console.log(` user.name: ${result.username}`);
|
|
105
|
+
console.log(` user.email: ${result.email}`);
|
|
106
|
+
console.log(` Scope: ${scope === 'global' ? 'global (--global)' : 'local (--local)'}`);
|
|
117
107
|
|
|
118
108
|
if (!options.dryRun) {
|
|
109
|
+
console.log('');
|
|
119
110
|
console.log('Git identity setup complete!');
|
|
111
|
+
console.log('');
|
|
112
|
+
console.log('You can verify your configuration with:');
|
|
113
|
+
console.log(' gh auth status');
|
|
114
|
+
console.log(` git config ${scope === 'global' ? '--global' : '--local'} user.name`);
|
|
115
|
+
console.log(` git config ${scope === 'global' ? '--global' : '--local'} user.email`);
|
|
120
116
|
}
|
|
121
117
|
|
|
122
118
|
process.exit(0);
|
|
@@ -125,7 +121,6 @@ async function main() {
|
|
|
125
121
|
console.error('Error:', error.message);
|
|
126
122
|
|
|
127
123
|
if (config.verbose) {
|
|
128
|
-
console.error('');
|
|
129
124
|
console.error('Stack trace:');
|
|
130
125
|
console.error(error.stack);
|
|
131
126
|
}
|
package/src/index.js
CHANGED
|
@@ -126,9 +126,6 @@ export async function runGhAuthLogin(options = {}) {
|
|
|
126
126
|
const { verbose = false, logger = console } = options;
|
|
127
127
|
const log = createDefaultLogger({ verbose, logger });
|
|
128
128
|
|
|
129
|
-
log(() => 'Starting GitHub CLI authentication...');
|
|
130
|
-
log(() => '');
|
|
131
|
-
|
|
132
129
|
// Run gh auth login with the required scopes
|
|
133
130
|
// Use 'y' as input to confirm default account selection
|
|
134
131
|
const result = await execInteractiveCommand('gh', [
|
|
@@ -144,8 +141,7 @@ export async function runGhAuthLogin(options = {}) {
|
|
|
144
141
|
return false;
|
|
145
142
|
}
|
|
146
143
|
|
|
147
|
-
log(() => '');
|
|
148
|
-
log(() => 'GitHub CLI authentication successful!');
|
|
144
|
+
log(() => '\nGitHub CLI authentication successful!');
|
|
149
145
|
return true;
|
|
150
146
|
}
|
|
151
147
|
|
|
@@ -327,16 +323,15 @@ export async function setupGitIdentity(options = {}) {
|
|
|
327
323
|
|
|
328
324
|
const log = createDefaultLogger({ verbose, logger });
|
|
329
325
|
|
|
330
|
-
log(() => '
|
|
326
|
+
log(() => '\nFetching GitHub user information...');
|
|
331
327
|
|
|
332
328
|
// Get GitHub user info
|
|
333
329
|
const { username, email } = await getGitHubUserInfo({ verbose, logger });
|
|
334
330
|
|
|
335
|
-
log(() => `GitHub user: ${username}`);
|
|
336
|
-
log(() => `GitHub email: ${email}`);
|
|
331
|
+
log(() => ` GitHub user: ${username}`);
|
|
332
|
+
log(() => ` GitHub email: ${email}`);
|
|
337
333
|
|
|
338
334
|
if (dryRun) {
|
|
339
|
-
log(() => '');
|
|
340
335
|
log(() => 'DRY MODE: Would configure the following:');
|
|
341
336
|
log(() => ` git config --${scope} user.name "${username}"`);
|
|
342
337
|
log(() => ` git config --${scope} user.email "${email}"`);
|
|
@@ -344,13 +339,12 @@ export async function setupGitIdentity(options = {}) {
|
|
|
344
339
|
}
|
|
345
340
|
|
|
346
341
|
// Set git config
|
|
347
|
-
log(() =>
|
|
348
|
-
log(() => `Configuring git (${scope})...`);
|
|
342
|
+
log(() => `\nConfiguring git (${scope})...`);
|
|
349
343
|
|
|
350
344
|
await setGitConfig('user.name', username, { scope, verbose, logger });
|
|
351
345
|
await setGitConfig('user.email', email, { scope, verbose, logger });
|
|
352
346
|
|
|
353
|
-
log(() => 'Git identity configured successfully!');
|
|
347
|
+
log(() => ' Git identity configured successfully!');
|
|
354
348
|
|
|
355
349
|
return { username, email };
|
|
356
350
|
}
|