@simplysf/simply-gitlab 0.11.0 → 0.13.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/README.md +828 -221
- package/docs/getting-started.md +5 -5
- package/docs/guides/credentials.md +38 -9
- package/docs/guides/scripting.md +20 -0
- package/docs/guides/write-safety.md +6 -6
- package/lib/commands/gitlab/branch/view.d.ts +11 -0
- package/lib/commands/gitlab/branch/view.js +51 -0
- package/lib/commands/gitlab/branch/view.js.map +1 -0
- package/lib/commands/gitlab/commit/compare.d.ts +13 -0
- package/lib/commands/gitlab/commit/compare.js +57 -0
- package/lib/commands/gitlab/commit/compare.js.map +1 -0
- package/lib/commands/gitlab/mr/list.d.ts +1 -1
- package/lib/commands/gitlab/mr/view.d.ts +1 -0
- package/lib/commands/gitlab/mr/view.js +8 -2
- package/lib/commands/gitlab/mr/view.js.map +1 -1
- package/lib/commands/gitlab/release/create.d.ts +20 -0
- package/lib/commands/gitlab/release/create.js +69 -0
- package/lib/commands/gitlab/release/create.js.map +1 -0
- package/lib/commands/gitlab/release/view.d.ts +11 -0
- package/lib/commands/gitlab/release/view.js +50 -0
- package/lib/commands/gitlab/release/view.js.map +1 -0
- package/lib/shared/base-command.d.ts +2 -0
- package/lib/shared/base-command.js +45 -7
- package/lib/shared/base-command.js.map +1 -1
- package/oclif.manifest.json +1550 -660
- package/package.json +3 -3
package/docs/getting-started.md
CHANGED
|
@@ -40,11 +40,11 @@ Every command reads its connection settings from environment variables, from fla
|
|
|
40
40
|
`.env` file passed with `-e/--env-file`:
|
|
41
41
|
|
|
42
42
|
```
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
SIMPLY_GITLAB_TOKEN=glpat-...
|
|
44
|
+
SIMPLY_GITLAB_URL=https://gitlab.example.com # omit entirely for gitlab.com
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
`
|
|
47
|
+
`SIMPLY_GITLAB_URL` defaults to `https://gitlab.com`, so a gitlab.com user needs only the token. See
|
|
48
48
|
[Credentials](/guides/credentials/) for precedence between flags, environment, and file, and for
|
|
49
49
|
trusting an internal certificate authority.
|
|
50
50
|
|
|
@@ -70,13 +70,13 @@ simply gitlab mr list --project group/subgroup/project
|
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
The path is URL-encoded for you — do not encode it yourself. If you work in one project most of
|
|
73
|
-
the time, set `
|
|
73
|
+
the time, set `SIMPLY_GITLAB_PROJECT` and drop the flag.
|
|
74
74
|
|
|
75
75
|
## Where to go next
|
|
76
76
|
|
|
77
77
|
- The [Command Reference](/reference/) lists every command by topic, with its flags and examples.
|
|
78
78
|
- [Credentials](/guides/credentials/) covers tokens, precedence, and certificates.
|
|
79
|
-
- [Write safety](/guides/write-safety/) explains `--dry-run`, `
|
|
79
|
+
- [Write safety](/guides/write-safety/) explains `--dry-run`, `SIMPLY_GITLAB_READ_ONLY`, and why a
|
|
80
80
|
`read_api` token is the only one of those that actually binds.
|
|
81
81
|
- [Scripts and agents](/guides/scripting/) covers the `--json` contract and exit codes.
|
|
82
82
|
- [MCP server](/guides/mcp-server/) gives an AI agent the same capabilities as tools, read-only by
|
|
@@ -8,13 +8,26 @@ Connection settings come from environment variables, from flags, or from a `.env
|
|
|
8
8
|
ignored.
|
|
9
9
|
|
|
10
10
|
```
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
SIMPLY_GITLAB_TOKEN=glpat-...
|
|
12
|
+
SIMPLY_GITLAB_URL=https://gitlab.example.com # omit entirely for gitlab.com
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
There are only two settings, and one of them has a default — `
|
|
15
|
+
There are only two settings, and one of them has a default — `SIMPLY_GITLAB_URL` is `https://gitlab.com`
|
|
16
16
|
unless you say otherwise. A gitlab.com user needs the token and nothing else.
|
|
17
17
|
|
|
18
|
+
## Renamed variables
|
|
19
|
+
|
|
20
|
+
Every variable now starts with `SIMPLY_`. The unprefixed names — `GITLAB_URL`, `GITLAB_TOKEN`,
|
|
21
|
+
`GITLAB_SSL_VERIFY`, `GITLAB_READ_ONLY`, and `GITLAB_PROJECT` — are shared with other GitLab tools
|
|
22
|
+
such as `glab` and most GitLab MCP servers, so a shell set up for one of those quietly configured
|
|
23
|
+
this CLI as well.
|
|
24
|
+
|
|
25
|
+
The old names are deprecated, not yet removed. Each still works while its `SIMPLY_` name is unset,
|
|
26
|
+
and a command that relies on one prints a warning to stderr naming the rename. Once both are set the
|
|
27
|
+
`SIMPLY_` name wins and the old one is ignored without comment, so another tool can keep its own
|
|
28
|
+
`GITLAB_TOKEN`. The unprefixed names will stop working in a future major release; rename them, in
|
|
29
|
+
your shell and in any `.env` file, by adding the prefix.
|
|
30
|
+
|
|
18
31
|
## Tokens and scopes
|
|
19
32
|
|
|
20
33
|
The token is a personal access token (**Preferences › Access tokens**), a project access token, or
|
|
@@ -33,6 +46,22 @@ like it should.
|
|
|
33
46
|
OAuth 2 tokens are not supported: GitLab accepts those only as `Authorization: Bearer`, and this
|
|
34
47
|
CLI runs no OAuth flow.
|
|
35
48
|
|
|
49
|
+
## CI job tokens
|
|
50
|
+
|
|
51
|
+
Inside a pipeline, `CI_JOB_TOKEN` can stand in for an access token. GitLab accepts it only under its
|
|
52
|
+
own `JOB-TOKEN` header, so say which kind of token it is:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
SIMPLY_GITLAB_TOKEN=$CI_JOB_TOKEN SIMPLY_GITLAB_TOKEN_KIND=job simply gitlab release view --tag "$CI_COMMIT_TAG"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`--gitlab-token-kind job` does the same from the command line. The kind is `personal` unless you set
|
|
59
|
+
it, and any value other than `personal` or `job` is an error rather than a silent fallback. This
|
|
60
|
+
variable is new, so it has no unprefixed name.
|
|
61
|
+
|
|
62
|
+
A job token can reach only some endpoints, and which ones depends on the GitLab version and on the
|
|
63
|
+
project's job token settings. A refused call is the usual authentication error, exit code `3`.
|
|
64
|
+
|
|
36
65
|
## Precedence
|
|
37
66
|
|
|
38
67
|
Explicit flags beat the environment, which beats the file's contents. That ordering is what makes
|
|
@@ -44,16 +73,16 @@ simply gitlab mr list -e ~/gitlab.env --project group/project
|
|
|
44
73
|
simply gitlab mr update -e ~/gitlab-write.env --project group/project --mr 42 --state close
|
|
45
74
|
```
|
|
46
75
|
|
|
47
|
-
A variable exported as an empty string does not outrank the file. `export
|
|
76
|
+
A variable exported as an empty string does not outrank the file. `export SIMPLY_GITLAB_TOKEN=` in a
|
|
48
77
|
wrapper script would otherwise discard the real token and fail as though nothing were configured.
|
|
49
78
|
|
|
50
79
|
## Naming a project
|
|
51
80
|
|
|
52
|
-
Not a credential, but it belongs in the same shell profile. `
|
|
81
|
+
Not a credential, but it belongs in the same shell profile. `SIMPLY_GITLAB_PROJECT` sets the default for
|
|
53
82
|
`-p/--project`:
|
|
54
83
|
|
|
55
84
|
```sh
|
|
56
|
-
export
|
|
85
|
+
export SIMPLY_GITLAB_PROJECT=group/subgroup/project
|
|
57
86
|
simply gitlab mr list
|
|
58
87
|
```
|
|
59
88
|
|
|
@@ -61,11 +90,11 @@ A project is named by numeric id or full path, and the path is URL-encoded for y
|
|
|
61
90
|
|
|
62
91
|
## Self-managed instances
|
|
63
92
|
|
|
64
|
-
Set `
|
|
93
|
+
Set `SIMPLY_GITLAB_URL` to the instance origin. A subpath is kept, because self-managed instances are
|
|
65
94
|
routinely served from one:
|
|
66
95
|
|
|
67
96
|
```
|
|
68
|
-
|
|
97
|
+
SIMPLY_GITLAB_URL=https://example.com/gitlab
|
|
69
98
|
```
|
|
70
99
|
|
|
71
100
|
One thing to watch: pasting a **project** URL from gitlab.com — `https://gitlab.com/group/project`
|
|
@@ -82,7 +111,7 @@ authority, trust that CA rather than disabling verification:
|
|
|
82
111
|
NODE_EXTRA_CA_CERTS=/path/to/ca.pem simply gitlab project list
|
|
83
112
|
```
|
|
84
113
|
|
|
85
|
-
A `
|
|
114
|
+
A `SIMPLY_GITLAB_SSL_VERIFY=false` carried over from other GitLab tooling is rejected with an error rather
|
|
86
115
|
than silently ignored, so nobody ends up believing verification is off when it is on, or the
|
|
87
116
|
reverse.
|
|
88
117
|
|
package/docs/guides/scripting.md
CHANGED
|
@@ -103,6 +103,26 @@ simply gitlab ci job list --project group/project --scope failed --limit 5 --jso
|
|
|
103
103
|
failures and certificate problems do not retry, because another attempt cannot fix them. A script
|
|
104
104
|
does not need its own retry loop around these commands.
|
|
105
105
|
|
|
106
|
+
The exception is `commit create`. A commit has nothing GitLab could use to spot a duplicate, so if a
|
|
107
|
+
proxy answers 502 after GitLab has already made the commit, sending it again would make a second
|
|
108
|
+
one. That command is therefore retried only when the request provably never reached GitLab (a 429,
|
|
109
|
+
or a refused connection). Any other failure is raised straight away, and the `--json` error carries
|
|
110
|
+
`"maybeApplied": true`:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"error": {
|
|
115
|
+
"name": "HttpError",
|
|
116
|
+
"message": "... The change may have been applied anyway; check before retrying.",
|
|
117
|
+
"exitCode": 1,
|
|
118
|
+
"status": 502,
|
|
119
|
+
"maybeApplied": true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
When you see it, check the branch with `commit list` before deciding whether to send the commit again.
|
|
125
|
+
|
|
106
126
|
## Never interactive
|
|
107
127
|
|
|
108
128
|
No command prompts or blocks on stdin. Every write takes `--dry-run`, and the one that cannot be
|
|
@@ -3,13 +3,13 @@ title: Write safety
|
|
|
3
3
|
description: The layers between a Simply GitLab command and a change to your repository, which of them is a real boundary, and why CI variable values are hidden by default.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
`commit create`, `mr create`, `mr update`, and `
|
|
8
|
-
Those
|
|
6
|
+
Nine commands change data — `project create`, `branch create`, `file create`, `file update`,
|
|
7
|
+
`commit create`, `mr create`, `mr update`, `mr merge`, and `release create`. Nothing in this CLI
|
|
8
|
+
deletes anything. Those nine sit behind several layers, and only the last is a real boundary.
|
|
9
9
|
|
|
10
10
|
## `--confirm` only where it cannot be undone
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Eight of those writes either create something or edit a merge request, and both are recoverable: a
|
|
13
13
|
branch can be deleted, a file can be committed over, a closed merge request can be reopened.
|
|
14
14
|
Requiring a confirmation for actions like those would train you to pass it always, at which point
|
|
15
15
|
it protects nothing while still implying that it does.
|
|
@@ -21,7 +21,7 @@ which merges without the merge train testing the change, requires it.
|
|
|
21
21
|
|
|
22
22
|
## `--dry-run`
|
|
23
23
|
|
|
24
|
-
Accepted by all
|
|
24
|
+
Accepted by all nine. It prints the exact request body that would be sent and sends nothing, which
|
|
25
25
|
is the cheapest way to see what is about to happen. The one nuance is `project create`: a namespace
|
|
26
26
|
or template given as a path is still looked up, so the printed ids are the ones that would be sent.
|
|
27
27
|
|
|
@@ -55,7 +55,7 @@ simply gitlab file update --project group/project --path README.md --branch main
|
|
|
55
55
|
|
|
56
56
|
Without it, the last writer silently wins.
|
|
57
57
|
|
|
58
|
-
## `
|
|
58
|
+
## `SIMPLY_GITLAB_READ_ONLY`
|
|
59
59
|
|
|
60
60
|
Set it to `1`, `true`, `yes`, or `on` and every write command refuses before making any request.
|
|
61
61
|
Reads are unaffected. This guards against misconfiguration: the wrong credential file, the wrong
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GitLabCommand } from '../../../shared/base-command.js';
|
|
2
|
+
export default class GitlabBranchView extends GitLabCommand<typeof GitlabBranchView> {
|
|
3
|
+
static readonly summary = "Show one branch.";
|
|
4
|
+
static readonly description: string;
|
|
5
|
+
static readonly examples: string[];
|
|
6
|
+
static readonly flags: {
|
|
7
|
+
branch: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<unknown>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Flags } from '@oclif/core';
|
|
17
|
+
import { formatKeyValue } from '@simplysf/simply-gitlab-core';
|
|
18
|
+
import { GitLabCommand, projectFlag } from '../../../shared/base-command.js';
|
|
19
|
+
export default class GitlabBranchView extends GitLabCommand {
|
|
20
|
+
static summary = 'Show one branch.';
|
|
21
|
+
static description = 'Looks the branch up by its exact name, unlike branch list --search, which matches any part of ' +
|
|
22
|
+
'a name. A branch that does not exist fails with status 404. So does a project the token cannot ' +
|
|
23
|
+
'see, so a 404 alone does not prove the branch is missing.';
|
|
24
|
+
static examples = [
|
|
25
|
+
'<%= config.bin %> <%= command.id %> --project group/project --branch main',
|
|
26
|
+
'<%= config.bin %> <%= command.id %> --project group/project --branch release/1.2 --json',
|
|
27
|
+
];
|
|
28
|
+
static flags = {
|
|
29
|
+
...projectFlag,
|
|
30
|
+
branch: Flags.string({ summary: 'Exact branch name.', required: true }),
|
|
31
|
+
};
|
|
32
|
+
async run() {
|
|
33
|
+
const branch = (await this.gitlab().getBranch(this.flags.project, this.flags.branch));
|
|
34
|
+
const traits = [
|
|
35
|
+
branch.default === true ? 'default' : undefined,
|
|
36
|
+
branch.protected === true ? 'protected' : undefined,
|
|
37
|
+
branch.merged === true ? 'merged' : undefined,
|
|
38
|
+
].filter((trait) => trait !== undefined);
|
|
39
|
+
this.logSafe(formatKeyValue([
|
|
40
|
+
['Branch', branch.name ?? this.flags.branch],
|
|
41
|
+
['Traits', traits.length === 0 ? undefined : traits.join(', ')],
|
|
42
|
+
['Commit', branch.commit?.id],
|
|
43
|
+
['Title', branch.commit?.title],
|
|
44
|
+
['Author', branch.commit?.author_name],
|
|
45
|
+
['Date', branch.commit?.committed_date],
|
|
46
|
+
['URL', branch.web_url],
|
|
47
|
+
]));
|
|
48
|
+
return branch;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/commands/gitlab/branch/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAgB7E,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,aAAsC;IAC3E,MAAM,CAAmB,OAAO,GAAG,kBAAkB,CAAC;IACtD,MAAM,CAAmB,WAAW,GACzC,gGAAgG;QAChG,iGAAiG;QACjG,2DAA2D,CAAC;IAEvD,MAAM,CAAmB,QAAQ,GAAG;QACzC,2EAA2E;QAC3E,yFAAyF;KAC1F,CAAC;IAEK,MAAM,CAAmB,KAAK,GAAG;QACtC,GAAG,WAAW;QACd,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KACxE,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAW,CAAC;QAEhG,MAAM,MAAM,GAAG;YACb,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YAC/C,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;YACnD,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;SAC9C,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;QAEzC,IAAI,CAAC,OAAO,CACV,cAAc,CAAC;YACb,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;YAC5C,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/D,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7B,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;YAC/B,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;YACtC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC;YACvC,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC;SACxB,CAAC,CACH,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GitLabCommand } from '../../../shared/base-command.js';
|
|
2
|
+
export default class GitlabCommitCompare extends GitLabCommand<typeof GitlabCommitCompare> {
|
|
3
|
+
static readonly summary = "Compare two branches, tags, or commits.";
|
|
4
|
+
static readonly description: string;
|
|
5
|
+
static readonly examples: string[];
|
|
6
|
+
static readonly flags: {
|
|
7
|
+
from: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
to: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
straight: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<unknown>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Flags } from '@oclif/core';
|
|
17
|
+
import { commitColumns, formatTable } from '@simplysf/simply-gitlab-core';
|
|
18
|
+
import { GitLabCommand, projectFlag } from '../../../shared/base-command.js';
|
|
19
|
+
export default class GitlabCommitCompare extends GitLabCommand {
|
|
20
|
+
static summary = 'Compare two branches, tags, or commits.';
|
|
21
|
+
static description = 'Lists the commits on --to that are not on --from, and counts the files they change. By ' +
|
|
22
|
+
'default the comparison starts where the two refs diverge, which answers "what would merging ' +
|
|
23
|
+
'--to bring in". --straight compares the two refs directly instead.\n\n' +
|
|
24
|
+
'GitLab limits how much one comparison returns and says so in the payload rather than ' +
|
|
25
|
+
'failing; this command says so too. Use --json for the diffs themselves.';
|
|
26
|
+
static examples = [
|
|
27
|
+
'<%= config.bin %> <%= command.id %> --project group/project --from v1.2.0 --to main',
|
|
28
|
+
'<%= config.bin %> <%= command.id %> --project group/project --from main --to feature --straight --json',
|
|
29
|
+
];
|
|
30
|
+
static flags = {
|
|
31
|
+
...projectFlag,
|
|
32
|
+
from: Flags.string({ summary: 'Branch, tag, or SHA to compare from.', required: true }),
|
|
33
|
+
to: Flags.string({ summary: 'Branch, tag, or SHA to compare to.', required: true }),
|
|
34
|
+
straight: Flags.boolean({
|
|
35
|
+
summary: 'Compare the two refs directly rather than from where they diverge.',
|
|
36
|
+
default: false,
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
async run() {
|
|
40
|
+
const comparison = (await this.gitlab().compare(this.flags.project, this.flags.from, this.flags.to, {
|
|
41
|
+
straight: this.flags.straight || undefined,
|
|
42
|
+
}));
|
|
43
|
+
const commits = comparison.commits ?? [];
|
|
44
|
+
if (commits.length === 0) {
|
|
45
|
+
this.logSafe(`No commits on ${this.flags.to} that are not on ${this.flags.from}.`);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.logSafe(formatTable(commits, commitColumns));
|
|
49
|
+
this.log(`\n${commits.length} commit(s), ${comparison.diffs?.length ?? 0} file(s) changed.`);
|
|
50
|
+
}
|
|
51
|
+
if (comparison.compare_timeout === true) {
|
|
52
|
+
this.log('GitLab stopped the comparison early, so this result is incomplete.');
|
|
53
|
+
}
|
|
54
|
+
return comparison;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=compare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../../src/commands/gitlab/commit/compare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAA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B,IAAI,CAAC,KAAK,CAAC,EAAE,oBAAoB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;QACrF,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;YAClD,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,eAAe,UAAU,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAC/F,CAAC;QACD,IAAI,UAAU,CAAC,eAAe,KAAK,IAAI,EAAE,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;QACjF,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC"}
|
|
@@ -4,7 +4,7 @@ export default class GitlabMrList extends GitLabCommand<typeof GitlabMrList> {
|
|
|
4
4
|
static readonly description: string;
|
|
5
5
|
static readonly examples: string[];
|
|
6
6
|
static readonly flags: {
|
|
7
|
-
state: import("@oclif/core/interfaces").OptionFlag<"
|
|
7
|
+
state: import("@oclif/core/interfaces").OptionFlag<"merged" | "opened" | "closed" | "locked" | "all", import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
'source-branch': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
9
|
'target-branch': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
'author-username': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -5,6 +5,7 @@ export default class GitlabMrView extends GitLabCommand<typeof GitlabMrView> {
|
|
|
5
5
|
static readonly examples: string[];
|
|
6
6
|
static readonly flags: {
|
|
7
7
|
mr: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
recheck: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
};
|
|
10
11
|
run(): Promise<unknown>;
|
|
@@ -20,18 +20,24 @@ export default class GitlabMrView extends GitLabCommand {
|
|
|
20
20
|
static summary = 'Show one merge request.';
|
|
21
21
|
static description = 'Takes the project-scoped iid — the number in the merge request URL — not the instance-wide ' +
|
|
22
22
|
'id. Use --json for the full payload, which carries the pipeline status, approvals, and diff ' +
|
|
23
|
-
'refs the summary below leaves out
|
|
23
|
+
'refs the summary below leaves out.\n\n' +
|
|
24
|
+
'Right after a push, GitLab can report a merge status it has not finished working out. ' +
|
|
25
|
+
'--recheck asks it to work the status out again before answering.';
|
|
24
26
|
static examples = [
|
|
25
27
|
'<%= config.bin %> <%= command.id %> --project group/project --mr 42',
|
|
26
28
|
'<%= config.bin %> <%= command.id %> --project group/project --mr 42 --json',
|
|
29
|
+
'<%= config.bin %> <%= command.id %> --project group/project --mr 42 --recheck',
|
|
27
30
|
];
|
|
28
31
|
static flags = {
|
|
29
32
|
...projectFlag,
|
|
30
33
|
mr: Flags.integer({ summary: 'Merge request iid.', required: true }),
|
|
34
|
+
recheck: Flags.boolean({ summary: 'Ask GitLab to recheck the merge status first.', default: false }),
|
|
31
35
|
};
|
|
32
36
|
async run() {
|
|
33
37
|
const iid = assertIid(this.flags.mr);
|
|
34
|
-
const mr = (await this.gitlab().getMergeRequest(this.flags.project, iid
|
|
38
|
+
const mr = (await this.gitlab().getMergeRequest(this.flags.project, iid, {
|
|
39
|
+
recheckMergeStatus: this.flags.recheck || undefined,
|
|
40
|
+
}));
|
|
35
41
|
this.logSafe(formatKeyValue([
|
|
36
42
|
['Merge request', `!${mr.iid ?? iid}`],
|
|
37
43
|
['Title', mr.title],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/commands/gitlab/mr/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GA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,EAAE,CAAC,WAAW,KAAK,QAAQ,IAAI,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACvE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GitLabCommand } from '../../../shared/base-command.js';
|
|
2
|
+
export default class GitlabReleaseCreate extends GitLabCommand<typeof GitlabReleaseCreate> {
|
|
3
|
+
static isWrite: boolean;
|
|
4
|
+
static readonly summary = "Create a release.";
|
|
5
|
+
static readonly description: string;
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly flags: {
|
|
8
|
+
tag: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
ref: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
milestone: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'released-at': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'body-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<unknown>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Flags } from '@oclif/core';
|
|
17
|
+
import { buildReleaseCreateBody, formatKeyValue, parseBodyInput } from '@simplysf/simply-gitlab-core';
|
|
18
|
+
import { GitLabCommand, projectFlag, writeFlags } from '../../../shared/base-command.js';
|
|
19
|
+
export default class GitlabReleaseCreate extends GitLabCommand {
|
|
20
|
+
static isWrite = true;
|
|
21
|
+
static summary = 'Create a release.';
|
|
22
|
+
static description = 'Attaches a release to --tag. When the tag does not exist yet, pass --ref and GitLab creates ' +
|
|
23
|
+
'the tag there first. When the tag exists, --ref is ignored, so this never moves a tag. A tag ' +
|
|
24
|
+
'carries at most one release, and a second create for it is refused with status 409.\n\n' +
|
|
25
|
+
'--body or --body-file supplies raw JSON for anything the flags do not cover, such as asset ' +
|
|
26
|
+
'links. Use --dry-run to see exactly what would be sent.';
|
|
27
|
+
static examples = [
|
|
28
|
+
'<%= config.bin %> <%= command.id %> --project group/project --tag v1.2.0 --name 1.2.0 --description "Bug fixes."',
|
|
29
|
+
'<%= config.bin %> <%= command.id %> --project group/project --tag v1.3.0 --ref main --dry-run',
|
|
30
|
+
];
|
|
31
|
+
static flags = {
|
|
32
|
+
...projectFlag,
|
|
33
|
+
...writeFlags,
|
|
34
|
+
tag: Flags.string({ summary: 'Tag to attach the release to.' }),
|
|
35
|
+
name: Flags.string({ summary: 'Release title. GitLab uses the tag name when it is omitted.' }),
|
|
36
|
+
description: Flags.string({ summary: 'Release notes, as Markdown.' }),
|
|
37
|
+
ref: Flags.string({ summary: 'Branch, tag, or SHA to create the tag from, when it does not exist yet.' }),
|
|
38
|
+
milestone: Flags.string({ summary: 'Milestone title to associate. Repeatable.', multiple: true }),
|
|
39
|
+
'released-at': Flags.string({ summary: 'Release date, as ISO 8601. Defaults to now.' }),
|
|
40
|
+
body: Flags.string({ summary: 'Raw JSON request body.', exclusive: ['body-file'] }),
|
|
41
|
+
'body-file': Flags.string({ summary: 'Path to a file holding the raw JSON request body.' }),
|
|
42
|
+
};
|
|
43
|
+
async run() {
|
|
44
|
+
const request = buildReleaseCreateBody({
|
|
45
|
+
tagName: this.flags.tag,
|
|
46
|
+
name: this.flags.name,
|
|
47
|
+
description: this.flags.description,
|
|
48
|
+
ref: this.flags.ref,
|
|
49
|
+
milestones: this.flags.milestone,
|
|
50
|
+
releasedAt: this.flags['released-at'],
|
|
51
|
+
body: parseBodyInput(this.flags.body, this.flags['body-file']),
|
|
52
|
+
});
|
|
53
|
+
if (this.flags['dry-run']) {
|
|
54
|
+
this.log('Dry run — not sent. Request body:');
|
|
55
|
+
this.logSafe(JSON.stringify(request, null, 2));
|
|
56
|
+
return request;
|
|
57
|
+
}
|
|
58
|
+
const created = (await this.gitlab().createRelease(this.flags.project, request));
|
|
59
|
+
this.logSafe(formatKeyValue([
|
|
60
|
+
['Created', created.name ?? created.tag_name],
|
|
61
|
+
['Tag', created.tag_name],
|
|
62
|
+
['Commit', created.commit?.id],
|
|
63
|
+
// eslint-disable-next-line no-underscore-dangle -- GitLab's field name
|
|
64
|
+
['URL', created._links?.self],
|
|
65
|
+
]));
|
|
66
|
+
return created;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/gitlab/release/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACtG,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AASzF,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,aAAyC;IACjF,MAAM,CAAU,OAAO,GAAG,IAAI,CAAC;IAE/B,MAAM,CAAmB,OAAO,GAAG,mBAAmB,CAAC;IACvD,MAAM,CAAmB,WAAW,GACzC,8FAA8F;QAC9F,+FAA+F;QAC/F,yFAAyF;QACzF,6FAA6F;QAC7F,yDAAyD,CAAC;IAErD,MAAM,CAAmB,QAAQ,GAAG;QACzC,kHAAkH;QAClH,+FAA+F;KAChG,CAAC;IAEK,MAAM,CAAmB,KAAK,GAAG;QACtC,GAAG,WAAW;QACd,GAAG,UAAU;QACb,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC;QAC/D,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,6DAA6D,EAAE,CAAC;QAC9F,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC;QACrE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,yEAAyE,EAAE,CAAC;QACzG,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,2CAA2C,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACjG,aAAa,EAA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IAAI,OAAO,CAAC,QAAQ,CAAC;YAC7C,CAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,CAAC;YACzB,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC9B,uEAAuE;YACvE,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;SAC9B,CAAC,CACH,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GitLabCommand } from '../../../shared/base-command.js';
|
|
2
|
+
export default class GitlabReleaseView extends GitLabCommand<typeof GitlabReleaseView> {
|
|
3
|
+
static readonly summary = "Show one release.";
|
|
4
|
+
static readonly description: string;
|
|
5
|
+
static readonly examples: string[];
|
|
6
|
+
static readonly flags: {
|
|
7
|
+
tag: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<unknown>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Flags } from '@oclif/core';
|
|
17
|
+
import { formatKeyValue } from '@simplysf/simply-gitlab-core';
|
|
18
|
+
import { GitLabCommand, projectFlag } from '../../../shared/base-command.js';
|
|
19
|
+
export default class GitlabReleaseView extends GitLabCommand {
|
|
20
|
+
static summary = 'Show one release.';
|
|
21
|
+
static description = 'Looks the release up by its tag. A tag that has no release fails with status 404, as does a ' +
|
|
22
|
+
'project the token cannot see. Use --json for asset links and milestones.';
|
|
23
|
+
static examples = [
|
|
24
|
+
'<%= config.bin %> <%= command.id %> --project group/project --tag v1.2.0',
|
|
25
|
+
'<%= config.bin %> <%= command.id %> --project group/project --tag v1.2.0 --json',
|
|
26
|
+
];
|
|
27
|
+
static flags = {
|
|
28
|
+
...projectFlag,
|
|
29
|
+
tag: Flags.string({ summary: 'Tag the release is attached to.', required: true }),
|
|
30
|
+
};
|
|
31
|
+
async run() {
|
|
32
|
+
const release = (await this.gitlab().getRelease(this.flags.project, this.flags.tag));
|
|
33
|
+
const released = release.upcoming_release === true ? `${release.released_at ?? '?'} (upcoming)` : release.released_at;
|
|
34
|
+
this.logSafe(formatKeyValue([
|
|
35
|
+
['Release', release.name],
|
|
36
|
+
['Tag', release.tag_name ?? this.flags.tag],
|
|
37
|
+
['Commit', release.commit?.id],
|
|
38
|
+
['Author', release.author?.username],
|
|
39
|
+
['Released', released],
|
|
40
|
+
// eslint-disable-next-line no-underscore-dangle -- GitLab's field name
|
|
41
|
+
['URL', release._links?.self],
|
|
42
|
+
]));
|
|
43
|
+
if (typeof release.description === 'string' && release.description.trim() !== '') {
|
|
44
|
+
this.log('');
|
|
45
|
+
this.logSafe(release.description.trimEnd());
|
|
46
|
+
}
|
|
47
|
+
return release;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../src/commands/gitlab/release/view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,E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EAAuE;YACvE,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;SAC9B,CAAC,CACH,CAAC;QACF,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACjF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC"}
|
|
@@ -28,6 +28,7 @@ export declare function limitFlag(fallback: number, what: string): {
|
|
|
28
28
|
declare const gitlabFlags: {
|
|
29
29
|
'gitlab-url': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
30
30
|
'gitlab-token': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
31
|
+
'gitlab-token-kind': Interfaces.OptionFlag<"personal" | "job" | undefined, Interfaces.CustomOptions>;
|
|
31
32
|
'env-file': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
32
33
|
};
|
|
33
34
|
export type GitLabFlags<T extends typeof Command> = Interfaces.InferredFlags<typeof gitlabFlags & T['flags']>;
|
|
@@ -45,6 +46,7 @@ export declare abstract class GitLabCommand<T extends typeof Command> extends Co
|
|
|
45
46
|
static baseFlags: {
|
|
46
47
|
'gitlab-url': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
47
48
|
'gitlab-token': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
49
|
+
'gitlab-token-kind': Interfaces.OptionFlag<"personal" | "job" | undefined, Interfaces.CustomOptions>;
|
|
48
50
|
'env-file': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
49
51
|
};
|
|
50
52
|
/**
|