glab-setup-git-identity 0.6.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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.github/workflows/release.yml +372 -0
- package/.husky/pre-commit +1 -0
- package/.jscpd.json +20 -0
- package/.prettierignore +7 -0
- package/.prettierrc +10 -0
- package/CHANGELOG.md +143 -0
- package/LICENSE +24 -0
- package/README.md +455 -0
- package/bunfig.toml +3 -0
- package/deno.json +7 -0
- package/docs/case-studies/issue-13/README.md +195 -0
- package/docs/case-studies/issue-13/hive-mind-issue-960.json +23 -0
- package/docs/case-studies/issue-13/hive-mind-pr-961-diff.txt +773 -0
- package/docs/case-studies/issue-13/hive-mind-pr-961.json +126 -0
- package/docs/case-studies/issue-21/README.md +384 -0
- package/docs/case-studies/issue-21/ci-logs/run-20803315337.txt +1188 -0
- package/docs/case-studies/issue-21/ci-logs/run-20885464993.txt +1310 -0
- package/docs/case-studies/issue-21/issue-111-data.txt +15 -0
- package/docs/case-studies/issue-21/issue-113-data.txt +15 -0
- package/docs/case-studies/issue-21/pr-112-data.json +109 -0
- package/docs/case-studies/issue-21/pr-112-diff.patch +1336 -0
- package/docs/case-studies/issue-21/pr-114-data.json +126 -0
- package/docs/case-studies/issue-21/pr-114-diff.patch +879 -0
- package/docs/case-studies/issue-3/README.md +338 -0
- package/docs/case-studies/issue-3/created-issues.md +32 -0
- package/docs/case-studies/issue-3/issue-data.json +29 -0
- package/docs/case-studies/issue-3/original-format-release-notes.mjs +212 -0
- package/docs/case-studies/issue-3/reference-pr-59-diff.txt +614 -0
- package/docs/case-studies/issue-3/reference-pr-59.json +109 -0
- package/docs/case-studies/issue-3/release-v0.1.0.json +9 -0
- package/docs/case-studies/issue-3/repositories-with-same-script.json +22 -0
- package/docs/case-studies/issue-3/research-notes.md +33 -0
- package/docs/case-studies/issue-7/BEST-PRACTICES-COMPARISON.md +334 -0
- package/docs/case-studies/issue-7/FORMATTER-COMPARISON.md +649 -0
- package/docs/case-studies/issue-7/current-repository-analysis.json +70 -0
- package/docs/case-studies/issue-7/effect-template-analysis.json +178 -0
- package/eslint.config.js +91 -0
- package/examples/basic-usage.js +64 -0
- package/experiments/test-changeset-scripts.mjs +303 -0
- package/experiments/test-failure-detection.mjs +143 -0
- package/experiments/test-format-major-changes.mjs +49 -0
- package/experiments/test-format-minor-changes.mjs +52 -0
- package/experiments/test-format-no-hash.mjs +43 -0
- package/experiments/test-format-patch-changes.mjs +46 -0
- package/package.json +80 -0
- package/scripts/changeset-version.mjs +75 -0
- package/scripts/check-changesets.mjs +67 -0
- package/scripts/check-version.mjs +129 -0
- package/scripts/create-github-release.mjs +93 -0
- package/scripts/create-manual-changeset.mjs +89 -0
- package/scripts/detect-code-changes.mjs +194 -0
- package/scripts/format-github-release.mjs +83 -0
- package/scripts/format-release-notes.mjs +219 -0
- package/scripts/instant-version-bump.mjs +172 -0
- package/scripts/js-paths.mjs +177 -0
- package/scripts/merge-changesets.mjs +263 -0
- package/scripts/publish-to-npm.mjs +302 -0
- package/scripts/setup-npm.mjs +37 -0
- package/scripts/validate-changeset.mjs +265 -0
- package/scripts/version-and-commit.mjs +284 -0
- package/src/cli.js +386 -0
- package/src/index.d.ts +255 -0
- package/src/index.js +563 -0
- package/tests/index.test.js +137 -0
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* glab-setup-git-identity - Type definitions for setting up git identity using GitLab CLI
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Logger options for customizing output
|
|
7
|
+
*/
|
|
8
|
+
export interface LoggerOptions {
|
|
9
|
+
/** Enable verbose/debug logging */
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
/** Custom logger instance (defaults to console) */
|
|
12
|
+
logger?: {
|
|
13
|
+
log: (...args: unknown[]) => void;
|
|
14
|
+
error?: (...args: unknown[]) => void;
|
|
15
|
+
warn?: (...args: unknown[]) => void;
|
|
16
|
+
debug?: (...args: unknown[]) => void;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Options for GitLab authentication
|
|
22
|
+
*/
|
|
23
|
+
export interface AuthOptions extends LoggerOptions {
|
|
24
|
+
/** GitLab instance hostname (default: 'gitlab.com') */
|
|
25
|
+
hostname?: string;
|
|
26
|
+
/** GitLab access token for non-interactive login */
|
|
27
|
+
token?: string;
|
|
28
|
+
/** Git protocol: 'ssh', 'https', or 'http' (default: 'https') */
|
|
29
|
+
gitProtocol?: 'ssh' | 'https' | 'http';
|
|
30
|
+
/** API protocol: 'https' or 'http' (default: 'https') */
|
|
31
|
+
apiProtocol?: 'https' | 'http';
|
|
32
|
+
/** Custom API host URL */
|
|
33
|
+
apiHost?: string;
|
|
34
|
+
/** Store token in OS keyring */
|
|
35
|
+
useKeyring?: boolean;
|
|
36
|
+
/** CI job token for authentication */
|
|
37
|
+
jobToken?: string;
|
|
38
|
+
/** Read token from stdin */
|
|
39
|
+
stdin?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Options for checking authentication status
|
|
44
|
+
*/
|
|
45
|
+
export interface AuthStatusOptions extends LoggerOptions {
|
|
46
|
+
/** GitLab instance hostname to check */
|
|
47
|
+
hostname?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Options for setting up git credential helper
|
|
52
|
+
*/
|
|
53
|
+
export interface SetupGitOptions extends LoggerOptions {
|
|
54
|
+
/** GitLab instance hostname (default: 'gitlab.com') */
|
|
55
|
+
hostname?: string;
|
|
56
|
+
/** Force setup by overwriting existing credential helper config (default: false) */
|
|
57
|
+
force?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Options for getting user information
|
|
62
|
+
*/
|
|
63
|
+
export interface UserInfoOptions extends LoggerOptions {
|
|
64
|
+
/** GitLab instance hostname */
|
|
65
|
+
hostname?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Options for git config operations
|
|
70
|
+
*/
|
|
71
|
+
export interface GitConfigOptions extends LoggerOptions {
|
|
72
|
+
/** Config scope: 'global' or 'local' (default: 'global') */
|
|
73
|
+
scope?: 'global' | 'local';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Options for setting up git identity
|
|
78
|
+
*/
|
|
79
|
+
export interface SetupOptions extends LoggerOptions {
|
|
80
|
+
/** GitLab instance hostname */
|
|
81
|
+
hostname?: string;
|
|
82
|
+
/** Config scope: 'global' or 'local' (default: 'global') */
|
|
83
|
+
scope?: 'global' | 'local';
|
|
84
|
+
/** Dry run mode - don't actually configure git */
|
|
85
|
+
dryRun?: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* User information returned from GitLab
|
|
90
|
+
*/
|
|
91
|
+
export interface UserInfo {
|
|
92
|
+
/** GitLab username */
|
|
93
|
+
username: string;
|
|
94
|
+
/** Primary email address */
|
|
95
|
+
email: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Git identity configuration
|
|
100
|
+
*/
|
|
101
|
+
export interface GitIdentity {
|
|
102
|
+
/** Configured user.name or null if not set */
|
|
103
|
+
username: string | null;
|
|
104
|
+
/** Configured user.email or null if not set */
|
|
105
|
+
email: string | null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Default options for glab auth login
|
|
110
|
+
*/
|
|
111
|
+
export declare const defaultAuthOptions: {
|
|
112
|
+
hostname: string;
|
|
113
|
+
gitProtocol: string;
|
|
114
|
+
apiProtocol: string;
|
|
115
|
+
useKeyring: boolean;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get the full path to the glab executable
|
|
120
|
+
*
|
|
121
|
+
* This function dynamically detects the glab installation path
|
|
122
|
+
* without depending on any specific installation method.
|
|
123
|
+
*
|
|
124
|
+
* @param options - Logger options
|
|
125
|
+
* @returns Full path to glab executable
|
|
126
|
+
* @throws Error if glab is not found
|
|
127
|
+
*/
|
|
128
|
+
export declare function getGlabPath(options?: LoggerOptions): Promise<string>;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Run glab auth login interactively
|
|
132
|
+
* @param options - Authentication options
|
|
133
|
+
* @returns True if login was successful
|
|
134
|
+
*/
|
|
135
|
+
export declare function runGlabAuthLogin(
|
|
136
|
+
options?: AuthOptions
|
|
137
|
+
): Promise<boolean>;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Run glab auth setup-git equivalent to configure git to use GitLab CLI as credential helper
|
|
141
|
+
*
|
|
142
|
+
* Unlike GitHub CLI which has `gh auth setup-git`, GitLab CLI doesn't have an equivalent command.
|
|
143
|
+
* This function manually configures git to use `glab auth git-credential` as the credential helper
|
|
144
|
+
* for GitLab HTTPS operations.
|
|
145
|
+
*
|
|
146
|
+
* Without this, git push/pull may fail with "could not read Username" error when using HTTPS protocol.
|
|
147
|
+
*
|
|
148
|
+
* @param options - Setup options
|
|
149
|
+
* @returns True if setup was successful
|
|
150
|
+
*/
|
|
151
|
+
export declare function runGlabAuthSetupGit(
|
|
152
|
+
options?: SetupGitOptions
|
|
153
|
+
): Promise<boolean>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Check if GitLab CLI is authenticated
|
|
157
|
+
* @param options - Options
|
|
158
|
+
* @returns True if authenticated
|
|
159
|
+
*/
|
|
160
|
+
export declare function isGlabAuthenticated(
|
|
161
|
+
options?: AuthStatusOptions
|
|
162
|
+
): Promise<boolean>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Get GitLab username from authenticated user
|
|
166
|
+
* @param options - Options
|
|
167
|
+
* @returns GitLab username
|
|
168
|
+
* @throws Error if not authenticated or API call fails
|
|
169
|
+
*/
|
|
170
|
+
export declare function getGitLabUsername(
|
|
171
|
+
options?: UserInfoOptions
|
|
172
|
+
): Promise<string>;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Get primary email from GitLab user
|
|
176
|
+
* @param options - Options
|
|
177
|
+
* @returns Primary email address
|
|
178
|
+
* @throws Error if not authenticated, API call fails, or no email is set
|
|
179
|
+
*/
|
|
180
|
+
export declare function getGitLabEmail(
|
|
181
|
+
options?: UserInfoOptions
|
|
182
|
+
): Promise<string>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Get GitLab user information (username and primary email)
|
|
186
|
+
* @param options - Options
|
|
187
|
+
* @returns User information object
|
|
188
|
+
* @throws Error if not authenticated or API calls fail
|
|
189
|
+
*/
|
|
190
|
+
export declare function getGitLabUserInfo(
|
|
191
|
+
options?: UserInfoOptions
|
|
192
|
+
): Promise<UserInfo>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Set git config value
|
|
196
|
+
* @param key - Config key (e.g., 'user.name')
|
|
197
|
+
* @param value - Config value
|
|
198
|
+
* @param options - Options
|
|
199
|
+
* @throws Error if git config command fails
|
|
200
|
+
*/
|
|
201
|
+
export declare function setGitConfig(
|
|
202
|
+
key: string,
|
|
203
|
+
value: string,
|
|
204
|
+
options?: GitConfigOptions
|
|
205
|
+
): Promise<void>;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Get git config value
|
|
209
|
+
* @param key - Config key (e.g., 'user.name')
|
|
210
|
+
* @param options - Options
|
|
211
|
+
* @returns Config value or null if not set
|
|
212
|
+
*/
|
|
213
|
+
export declare function getGitConfig(
|
|
214
|
+
key: string,
|
|
215
|
+
options?: GitConfigOptions
|
|
216
|
+
): Promise<string | null>;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Setup git identity based on GitLab user
|
|
220
|
+
* @param options - Setup options
|
|
221
|
+
* @returns Configured identity (username and email)
|
|
222
|
+
* @throws Error if not authenticated or configuration fails
|
|
223
|
+
*/
|
|
224
|
+
export declare function setupGitIdentity(
|
|
225
|
+
options?: SetupOptions
|
|
226
|
+
): Promise<UserInfo>;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Verify git identity is configured correctly
|
|
230
|
+
* @param options - Options
|
|
231
|
+
* @returns Current git identity
|
|
232
|
+
*/
|
|
233
|
+
export declare function verifyGitIdentity(
|
|
234
|
+
options?: GitConfigOptions
|
|
235
|
+
): Promise<GitIdentity>;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Default export with all functions
|
|
239
|
+
*/
|
|
240
|
+
declare const _default: {
|
|
241
|
+
defaultAuthOptions: typeof defaultAuthOptions;
|
|
242
|
+
getGlabPath: typeof getGlabPath;
|
|
243
|
+
isGlabAuthenticated: typeof isGlabAuthenticated;
|
|
244
|
+
runGlabAuthLogin: typeof runGlabAuthLogin;
|
|
245
|
+
runGlabAuthSetupGit: typeof runGlabAuthSetupGit;
|
|
246
|
+
getGitLabUsername: typeof getGitLabUsername;
|
|
247
|
+
getGitLabEmail: typeof getGitLabEmail;
|
|
248
|
+
getGitLabUserInfo: typeof getGitLabUserInfo;
|
|
249
|
+
setGitConfig: typeof setGitConfig;
|
|
250
|
+
getGitConfig: typeof getGitConfig;
|
|
251
|
+
setupGitIdentity: typeof setupGitIdentity;
|
|
252
|
+
verifyGitIdentity: typeof verifyGitIdentity;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
export default _default;
|