@simplysf/simply-gitlab 0.1.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.
Files changed (75) hide show
  1. package/README.md +1203 -0
  2. package/bin/run.js +9 -0
  3. package/lib/commands/gitlab/branch/create.d.ts +14 -0
  4. package/lib/commands/gitlab/branch/create.js +50 -0
  5. package/lib/commands/gitlab/branch/create.js.map +1 -0
  6. package/lib/commands/gitlab/branch/list.d.ts +12 -0
  7. package/lib/commands/gitlab/branch/list.js +45 -0
  8. package/lib/commands/gitlab/branch/list.js.map +1 -0
  9. package/lib/commands/gitlab/ci/environment/list.d.ts +14 -0
  10. package/lib/commands/gitlab/ci/environment/list.js +47 -0
  11. package/lib/commands/gitlab/ci/environment/list.js.map +1 -0
  12. package/lib/commands/gitlab/ci/job/list.d.ts +12 -0
  13. package/lib/commands/gitlab/ci/job/list.js +55 -0
  14. package/lib/commands/gitlab/ci/job/list.js.map +1 -0
  15. package/lib/commands/gitlab/ci/job/log.d.ts +12 -0
  16. package/lib/commands/gitlab/ci/job/log.js +54 -0
  17. package/lib/commands/gitlab/ci/job/log.js.map +1 -0
  18. package/lib/commands/gitlab/ci/variable/list.d.ts +12 -0
  19. package/lib/commands/gitlab/ci/variable/list.js +56 -0
  20. package/lib/commands/gitlab/ci/variable/list.js.map +1 -0
  21. package/lib/commands/gitlab/commit/create.d.ts +22 -0
  22. package/lib/commands/gitlab/commit/create.js +74 -0
  23. package/lib/commands/gitlab/commit/create.js.map +1 -0
  24. package/lib/commands/gitlab/commit/diff.d.ts +12 -0
  25. package/lib/commands/gitlab/commit/diff.js +61 -0
  26. package/lib/commands/gitlab/commit/diff.js.map +1 -0
  27. package/lib/commands/gitlab/commit/list.d.ts +17 -0
  28. package/lib/commands/gitlab/commit/list.js +58 -0
  29. package/lib/commands/gitlab/commit/list.js.map +1 -0
  30. package/lib/commands/gitlab/commit/view.d.ts +11 -0
  31. package/lib/commands/gitlab/commit/view.js +52 -0
  32. package/lib/commands/gitlab/commit/view.js.map +1 -0
  33. package/lib/commands/gitlab/file/create.d.ts +20 -0
  34. package/lib/commands/gitlab/file/create.js +65 -0
  35. package/lib/commands/gitlab/file/create.js.map +1 -0
  36. package/lib/commands/gitlab/file/update.d.ts +21 -0
  37. package/lib/commands/gitlab/file/update.js +67 -0
  38. package/lib/commands/gitlab/file/update.js.map +1 -0
  39. package/lib/commands/gitlab/file/view.d.ts +13 -0
  40. package/lib/commands/gitlab/file/view.js +59 -0
  41. package/lib/commands/gitlab/file/view.js.map +1 -0
  42. package/lib/commands/gitlab/mr/create.d.ts +25 -0
  43. package/lib/commands/gitlab/mr/create.js +77 -0
  44. package/lib/commands/gitlab/mr/create.js.map +1 -0
  45. package/lib/commands/gitlab/mr/list.d.ts +18 -0
  46. package/lib/commands/gitlab/mr/list.js +64 -0
  47. package/lib/commands/gitlab/mr/list.js.map +1 -0
  48. package/lib/commands/gitlab/mr/update.d.ts +25 -0
  49. package/lib/commands/gitlab/mr/update.js +82 -0
  50. package/lib/commands/gitlab/mr/update.js.map +1 -0
  51. package/lib/commands/gitlab/mr/view.d.ts +11 -0
  52. package/lib/commands/gitlab/mr/view.js +54 -0
  53. package/lib/commands/gitlab/mr/view.js.map +1 -0
  54. package/lib/commands/gitlab/project/list.d.ts +14 -0
  55. package/lib/commands/gitlab/project/list.js +56 -0
  56. package/lib/commands/gitlab/project/list.js.map +1 -0
  57. package/lib/commands/gitlab/project/view.d.ts +10 -0
  58. package/lib/commands/gitlab/project/view.js +45 -0
  59. package/lib/commands/gitlab/project/view.js.map +1 -0
  60. package/lib/commands/gitlab/release/list.d.ts +11 -0
  61. package/lib/commands/gitlab/release/list.js +43 -0
  62. package/lib/commands/gitlab/release/list.js.map +1 -0
  63. package/lib/commands/gitlab/search.d.ts +14 -0
  64. package/lib/commands/gitlab/search.js +68 -0
  65. package/lib/commands/gitlab/search.js.map +1 -0
  66. package/lib/commands/gitlab/tag/list.d.ts +14 -0
  67. package/lib/commands/gitlab/tag/list.js +50 -0
  68. package/lib/commands/gitlab/tag/list.js.map +1 -0
  69. package/lib/index.d.ts +1 -0
  70. package/lib/index.js +22 -0
  71. package/lib/index.js.map +1 -0
  72. package/lib/shared/base-command.d.ts +91 -0
  73. package/lib/shared/base-command.js +242 -0
  74. package/lib/shared/base-command.js.map +1 -0
  75. package/package.json +243 -0
package/bin/run.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+
3
+ // eslint-disable-next-line node/shebang
4
+ async function main() {
5
+ const { execute } = await import('@oclif/core');
6
+ await execute({ dir: import.meta.url });
7
+ }
8
+
9
+ await main();
@@ -0,0 +1,14 @@
1
+ import { GitLabCommand } from '../../../shared/base-command.js';
2
+ export default class GitlabBranchCreate extends GitLabCommand<typeof GitlabBranchCreate> {
3
+ static isWrite: boolean;
4
+ static readonly summary = "Create a branch.";
5
+ static readonly description: string;
6
+ static readonly examples: string[];
7
+ static readonly flags: {
8
+ branch: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ ref: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ };
13
+ run(): Promise<unknown>;
14
+ }
@@ -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, writeFlags } from '../../../shared/base-command.js';
19
+ export default class GitlabBranchCreate extends GitLabCommand {
20
+ static isWrite = true;
21
+ static summary = 'Create a branch.';
22
+ static description = 'Points a new branch at an existing branch, tag, or commit SHA. GitLab refuses a name that ' +
23
+ 'already exists rather than moving it, so this can never rewrite a branch someone else is using.';
24
+ static examples = [
25
+ '<%= config.bin %> <%= command.id %> --project group/project --branch feature/thing --ref main',
26
+ '<%= config.bin %> <%= command.id %> --project group/project --branch hotfix --ref v1.2.0',
27
+ ];
28
+ static flags = {
29
+ ...projectFlag,
30
+ ...writeFlags,
31
+ branch: Flags.string({ summary: 'Name of the new branch.', required: true }),
32
+ ref: Flags.string({ summary: 'Branch, tag, or commit SHA to branch from.', required: true }),
33
+ };
34
+ async run() {
35
+ const request = { branch: this.flags.branch, ref: this.flags.ref };
36
+ if (this.flags['dry-run']) {
37
+ this.log('Dry run — not sent. Request body:');
38
+ this.log(JSON.stringify(request, null, 2));
39
+ return request;
40
+ }
41
+ const created = (await this.gitlab().createBranch(this.flags.project, this.flags.branch, this.flags.ref));
42
+ this.logSafe(formatKeyValue([
43
+ ['Created', created.name ?? this.flags.branch],
44
+ ['Commit', created.commit?.short_id],
45
+ ['URL', created.web_url],
46
+ ]));
47
+ return created;
48
+ }
49
+ }
50
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/gitlab/branch/create.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,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAQzF,MAAM,CAAC,OAAO,OAAO,kBAAmB,SA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I,CAAC,KAAK,CAAC,MAAM,CAAC;YAC9C,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC;YACpC,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC;SACzB,CAAC,CACH,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { GitLabCommand } from '../../../shared/base-command.js';
2
+ export default class GitlabBranchList extends GitLabCommand<typeof GitlabBranchList> {
3
+ static readonly summary = "List repository branches.";
4
+ static readonly description: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ search: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ limit: import("@oclif/core/interfaces").OptionFlag<number>;
9
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<unknown>;
12
+ }
@@ -0,0 +1,45 @@
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 { branchColumns, formatTable } from '@simplysf/simply-gitlab-core';
18
+ import { GitLabCommand, limitFlag, projectFlag } from '../../../shared/base-command.js';
19
+ const DEFAULT_LIMIT = 20;
20
+ export default class GitlabBranchList extends GitLabCommand {
21
+ static summary = 'List repository branches.';
22
+ static description = 'Branches come back in GitLab order, which is alphabetical rather than by recency, so on a ' +
23
+ 'busy repository --search is usually what you want. The MERGED column reflects whether the ' +
24
+ 'branch is merged into the default branch, not into whatever you are working on.';
25
+ static examples = [
26
+ '<%= config.bin %> <%= command.id %> --project group/project',
27
+ '<%= config.bin %> <%= command.id %> --project group/project --search release --limit 50',
28
+ ];
29
+ static flags = {
30
+ ...projectFlag,
31
+ ...limitFlag(DEFAULT_LIMIT, 'branches'),
32
+ search: Flags.string({ summary: 'Return only branches whose name contains this term.' }),
33
+ };
34
+ async run() {
35
+ const result = await this.gitlab().listBranches(this.flags.project, { search: this.flags.search }, this.flags.limit);
36
+ if (result.items.length === 0) {
37
+ this.log('No branches matched.');
38
+ return result;
39
+ }
40
+ this.logSafe(formatTable(result.items, branchColumns));
41
+ this.reportList(result.items.length, result.total, result.complete, this.flags.limit, 'branch(es)');
42
+ return result;
43
+ }
44
+ }
45
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/gitlab/branch/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAY,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAExF,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,aAAsC;IAC3E,MAAM,CAAmB,OAAO,GAAG,2BAA2B,CAAC;IAC/D,MAAM,CAAmB,WAAW,GACzC,4FAA4F;QAC5F,4FAA4F;QAC5F,iFAAiF,CAAC;IAE7E,MAAM,CAAmB,QAAQ,GAAG;QACzC,6DAA6D;QAC7D,yFAAyF;KAC1F,CAAC;IAEK,MAAM,CAAmB,KAAK,GAAG;QACtC,GAAG,WAAW;QACd,GAAG,SAAS,CAAC,aAAa,EAAE,UAAU,CAAC;QACvC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,qDAAqD,EAAE,CAAC;KACzF,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,YAAY,CAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,EAClB,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAC7B,IAAI,CAAC,KAAK,CAAC,KAAK,CACjB,CAAC;QAEF,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;YACjC,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,KAAc,EAAE,aAAa,CAAC,CAAC,CAAC;QAChE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QACpG,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { GitLabCommand } from '../../../../shared/base-command.js';
2
+ export default class GitlabCiEnvironmentList extends GitLabCommand<typeof GitlabCiEnvironmentList> {
3
+ static readonly summary = "List a project deployment environments.";
4
+ static readonly description: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ search: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ state: import("@oclif/core/interfaces").OptionFlag<"available" | "stopped" | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ limit: import("@oclif/core/interfaces").OptionFlag<number>;
11
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ };
13
+ run(): Promise<unknown>;
14
+ }
@@ -0,0 +1,47 @@
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 { environmentColumns, formatTable } from '@simplysf/simply-gitlab-core';
18
+ import { GitLabCommand, limitFlag, projectFlag } from '../../../../shared/base-command.js';
19
+ const DEFAULT_LIMIT = 20;
20
+ export default class GitlabCiEnvironmentList extends GitLabCommand {
21
+ static summary = 'List a project deployment environments.';
22
+ static description = 'Environments are what CI deploys to and what review apps create. Both available and stopped ' +
23
+ 'ones are listed; --state narrows to one. Use --json for the last deployment on each, which ' +
24
+ 'is the field worth having when you are answering "what is running where".';
25
+ static examples = [
26
+ '<%= config.bin %> <%= command.id %> --project group/project',
27
+ '<%= config.bin %> <%= command.id %> --project group/project --state available --search prod',
28
+ ];
29
+ static flags = {
30
+ ...projectFlag,
31
+ ...limitFlag(DEFAULT_LIMIT, 'environments'),
32
+ name: Flags.string({ summary: 'Return the environment with exactly this name.' }),
33
+ search: Flags.string({ summary: 'Return environments whose name contains this term.' }),
34
+ state: Flags.option({ summary: 'Environment state.', options: ['available', 'stopped'] })(),
35
+ };
36
+ async run() {
37
+ const result = await this.gitlab().listEnvironments(this.flags.project, { name: this.flags.name, search: this.flags.search, states: this.flags.state }, this.flags.limit);
38
+ if (result.items.length === 0) {
39
+ this.log('No environments matched.');
40
+ return result;
41
+ }
42
+ this.logSafe(formatTable(result.items, environmentColumns));
43
+ this.reportList(result.items.length, result.total, result.complete, this.flags.limit, 'environment(s)');
44
+ return result;
45
+ }
46
+ }
47
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../src/commands/gitlab/ci/environment/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAY,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAE3F,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,aAA6C;IACzF,MAAM,CAAmB,OAAO,GAAG,yCAAyC,CAAC;IAC7E,MAAM,CAAmB,WAAW,GACzC,8FAA8F;QAC9F,6FAA6F;QAC7F,2EAA2E,CAAC;IAEvE,MAAM,CAAmB,QAAQ,GAAG;QACzC,6DAA6D;QAC7D,6FAA6F;KAC9F,CAAC;IAEK,MAAM,CAAmB,KAAK,GAAG;QACtC,GAAG,WAAW;QACd,GAAG,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC;QAC3C,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gDAAgD,EAAE,CAAC;QACjF,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,oDAAoD,EAAE,CAAC;QACvF,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,CAAC,WAAW,EAAE,SAAS,CAAU,EAAE,CAAC,EAAE;KACrG,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,gBAAgB,CACjD,IAAI,CAAC,KAAK,CAAC,OAAO,EAClB,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAC9E,IAAI,CAAC,KAAK,CAAC,KAAK,CACjB,CAAC;QAEF,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;YACrC,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,KAAc,EAAE,kBAAkB,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;QACxG,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { GitLabCommand } from '../../../../shared/base-command.js';
2
+ export default class GitlabCiJobList extends GitLabCommand<typeof GitlabCiJobList> {
3
+ static readonly summary = "List CI jobs for a project.";
4
+ static readonly description: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ scope: import("@oclif/core/interfaces").OptionFlag<("created" | "pending" | "running" | "failed" | "success" | "canceled" | "skipped" | "waiting_for_resource" | "manual")[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ limit: import("@oclif/core/interfaces").OptionFlag<number>;
9
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<unknown>;
12
+ }
@@ -0,0 +1,55 @@
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 { formatTable, jobColumns } from '@simplysf/simply-gitlab-core';
18
+ import { GitLabCommand, limitFlag, projectFlag } from '../../../../shared/base-command.js';
19
+ const DEFAULT_LIMIT = 20;
20
+ const SCOPES = [
21
+ 'created',
22
+ 'pending',
23
+ 'running',
24
+ 'failed',
25
+ 'success',
26
+ 'canceled',
27
+ 'skipped',
28
+ 'waiting_for_resource',
29
+ 'manual',
30
+ ];
31
+ export default class GitlabCiJobList extends GitLabCommand {
32
+ static summary = 'List CI jobs for a project.';
33
+ static description = 'Jobs across every pipeline, newest first. --scope is repeatable and the scopes are ORed, so ' +
34
+ '--scope failed --scope running is "either". The ID column is what ci job log takes.';
35
+ static examples = [
36
+ '<%= config.bin %> <%= command.id %> --project group/project --scope failed --limit 10',
37
+ '<%= config.bin %> <%= command.id %> --project group/project --scope running --scope pending',
38
+ ];
39
+ static flags = {
40
+ ...projectFlag,
41
+ ...limitFlag(DEFAULT_LIMIT, 'jobs'),
42
+ scope: Flags.option({ summary: 'Job states to include. Repeatable.', options: SCOPES, multiple: true })(),
43
+ };
44
+ async run() {
45
+ const result = await this.gitlab().listJobs(this.flags.project, { scope: this.flags.scope }, this.flags.limit);
46
+ if (result.items.length === 0) {
47
+ this.log('No jobs matched.');
48
+ return result;
49
+ }
50
+ this.logSafe(formatTable(result.items, jobColumns));
51
+ this.reportList(result.items.length, result.total, result.complete, this.flags.limit, 'job(s)');
52
+ return result;
53
+ }
54
+ }
55
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../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C,GAAG,CAAC,kBAAkB,CAAC,CAAC;YAC7B,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,KAAc,EAAE,UAAU,CAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAChG,OAAO,MAAM,CAAC;IAChB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { GitLabCommand } from '../../../../shared/base-command.js';
2
+ export default class GitlabCiJobLog extends GitLabCommand<typeof GitlabCiJobLog> {
3
+ static readonly summary = "Print a job log.";
4
+ static readonly description: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ job: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
8
+ tail: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
9
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<unknown>;
12
+ }
@@ -0,0 +1,54 @@
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 { tailLog } from '@simplysf/simply-gitlab-core';
18
+ import { GitLabCommand, projectFlag } from '../../../../shared/base-command.js';
19
+ const DEFAULT_TAIL = 200;
20
+ export default class GitlabCiJobLog extends GitLabCommand {
21
+ static summary = 'Print a job log.';
22
+ static description = 'A job trace regularly runs to tens of megabytes, and what matters about a failed job is at ' +
23
+ 'the end, so only the last 200 lines are printed. --tail changes that number and --tail 0 ' +
24
+ 'prints the whole thing.\n\n' +
25
+ 'The trace is written by whatever the job ran, which means it is arbitrary text from an ' +
26
+ 'untrusted source. Control characters are stripped before it is printed, so the coloured ' +
27
+ 'output a runner emits arrives here plain.';
28
+ static examples = [
29
+ '<%= config.bin %> <%= command.id %> --project group/project --job 12345',
30
+ '<%= config.bin %> <%= command.id %> --project group/project --job 12345 --tail 0',
31
+ ];
32
+ static flags = {
33
+ ...projectFlag,
34
+ job: Flags.integer({ summary: 'Job id, as listed by ci job list.', required: true }),
35
+ tail: Flags.integer({
36
+ summary: 'Print only the last N lines. 0 prints the whole trace.',
37
+ default: DEFAULT_TAIL,
38
+ min: 0,
39
+ }),
40
+ };
41
+ async run() {
42
+ const log = await this.gitlab().getJobLog(this.flags.project, this.flags.job);
43
+ if (log.trim() === '') {
44
+ this.log('This job has no log yet.');
45
+ return { job: this.flags.job, log: '', truncated: false };
46
+ }
47
+ const { text, truncated } = tailLog(log, this.flags.tail);
48
+ if (truncated)
49
+ this.log(`(showing the last ${this.flags.tail} lines; pass --tail 0 for the whole trace)\n`);
50
+ this.logSafe(text.trimEnd());
51
+ return { job: this.flags.job, log: text, truncated };
52
+ }
53
+ }
54
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../../src/commands/gitlab/ci/job/log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEh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,IAAI,8CAA8C,CAAC,CAAC;QAC5G,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IACvD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { GitLabCommand } from '../../../../shared/base-command.js';
2
+ export default class GitlabCiVariableList extends GitLabCommand<typeof GitlabCiVariableList> {
3
+ static readonly summary = "List a project CI/CD variables.";
4
+ static readonly description: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ reveal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ limit: import("@oclif/core/interfaces").OptionFlag<number>;
9
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<unknown>;
12
+ }
@@ -0,0 +1,56 @@
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 { formatTable, maskVariables, variableColumns } from '@simplysf/simply-gitlab-core';
18
+ import { GitLabCommand, limitFlag, projectFlag } from '../../../../shared/base-command.js';
19
+ const DEFAULT_LIMIT = 50;
20
+ export default class GitlabCiVariableList extends GitLabCommand {
21
+ static summary = 'List a project CI/CD variables.';
22
+ static description = 'Variable values are hidden by default, including under --json. GitLab returns every value in ' +
23
+ 'clear text on this endpoint — the "masked" attribute only hides a value in job logs, not from ' +
24
+ 'the API — and those values are deploy keys and production credentials.\n\n' +
25
+ 'Pass --reveal to print them. Doing so puts live secrets on stdout, into your shell history if ' +
26
+ 'you redirect it, and into the context of anything reading this output, so it is a deliberate ' +
27
+ 'step rather than the default.';
28
+ static examples = [
29
+ '<%= config.bin %> <%= command.id %> --project group/project',
30
+ '<%= config.bin %> <%= command.id %> --project group/project --reveal',
31
+ ];
32
+ static flags = {
33
+ ...projectFlag,
34
+ ...limitFlag(DEFAULT_LIMIT, 'variables'),
35
+ reveal: Flags.boolean({
36
+ summary: 'Print the variable values in clear text.',
37
+ description: 'Off by default. Every value on this endpoint is a live secret, so revealing them is worth ' +
38
+ 'a moment of thought about where this output is going.',
39
+ default: false,
40
+ }),
41
+ };
42
+ async run() {
43
+ const result = await this.gitlab().listVariables(this.flags.project, this.flags.limit);
44
+ const items = this.flags.reveal ? result.items : maskVariables(result.items);
45
+ if (items.length === 0) {
46
+ this.log('This project has no CI/CD variables.');
47
+ return { ...result, items };
48
+ }
49
+ this.logSafe(formatTable(items, variableColumns));
50
+ this.reportList(items.length, result.total, result.complete, this.flags.limit, 'variable(s)');
51
+ if (!this.flags.reveal)
52
+ this.log('Values are hidden. Pass --reveal to print them.');
53
+ return { ...result, items };
54
+ }
55
+ }
56
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../../src/commands/gitlab/ci/variable/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAY,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAE3F,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,aA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;QAC9F,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,IAAI,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;QAEpF,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { GitLabCommand } from '../../../shared/base-command.js';
2
+ export default class GitlabCommitCreate extends GitLabCommand<typeof GitlabCommitCreate> {
3
+ static isWrite: boolean;
4
+ static readonly summary = "Commit several file changes at once.";
5
+ static readonly description: string;
6
+ static readonly examples: string[];
7
+ static readonly flags: {
8
+ branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ message: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ actions: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ 'start-branch': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ 'start-sha': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'author-email': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'author-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ body: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ 'body-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
+ };
21
+ run(): Promise<unknown>;
22
+ }
@@ -0,0 +1,74 @@
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 { buildCommitBody, formatKeyValue, parseActionsInput, parseBodyInput } from '@simplysf/simply-gitlab-core';
18
+ import { GitLabCommand, projectFlag, writeFlags } from '../../../shared/base-command.js';
19
+ export default class GitlabCommitCreate extends GitLabCommand {
20
+ static isWrite = true;
21
+ static summary = 'Commit several file changes at once.';
22
+ static description = 'Sends one commit containing a batch of actions — create, update, delete, move, chmod — which ' +
23
+ 'is how GitLab writes more than one file atomically. The actions are JSON, supplied with ' +
24
+ '--actions or inside a --body-file, because there is no readable flag form for a list of ' +
25
+ 'file operations.\n\n' +
26
+ 'Each action is an object with an "action" and a "file_path"; create and update also need ' +
27
+ '"content", move needs "previous_path", and chmod needs "execute_filemode". Those rules are ' +
28
+ 'checked before anything is sent, so a bad entry names its own index.\n\n' +
29
+ 'Use --dry-run to see exactly what would be sent.';
30
+ static examples = [
31
+ '<%= config.bin %> <%= command.id %> --project group/project --branch main --message "chore: tidy" --actions \'[{"action":"delete","file_path":"old.txt"}]\'',
32
+ '<%= config.bin %> <%= command.id %> --project group/project --branch main --message "feat: batch" --body-file ./commit.json --dry-run',
33
+ ];
34
+ static flags = {
35
+ ...projectFlag,
36
+ ...writeFlags,
37
+ branch: Flags.string({ summary: 'Branch to commit to.' }),
38
+ message: Flags.string({ summary: 'Commit message.' }),
39
+ actions: Flags.string({ summary: 'JSON array of file actions.' }),
40
+ 'start-branch': Flags.string({ summary: 'Branch to create --branch from, if it does not exist.' }),
41
+ 'start-sha': Flags.string({ summary: 'Commit SHA to start the new commit from.' }),
42
+ 'author-email': Flags.string({ summary: 'Commit author email.' }),
43
+ 'author-name': Flags.string({ summary: 'Commit author name.' }),
44
+ force: Flags.boolean({ summary: 'Overwrite the branch with the new commit.', default: false }),
45
+ body: Flags.string({ summary: 'Raw JSON request body.', exclusive: ['body-file'] }),
46
+ 'body-file': Flags.string({ summary: 'Path to a file holding the raw JSON request body.' }),
47
+ };
48
+ async run() {
49
+ const request = buildCommitBody({
50
+ branch: this.flags.branch,
51
+ message: this.flags.message,
52
+ actions: parseActionsInput(this.flags.actions),
53
+ startBranch: this.flags['start-branch'],
54
+ startSha: this.flags['start-sha'],
55
+ authorEmail: this.flags['author-email'],
56
+ authorName: this.flags['author-name'],
57
+ force: this.flags.force || undefined,
58
+ body: parseBodyInput(this.flags.body, this.flags['body-file']),
59
+ });
60
+ if (this.flags['dry-run']) {
61
+ this.log('Dry run — not sent. Request body:');
62
+ this.logSafe(JSON.stringify(request, null, 2));
63
+ return request;
64
+ }
65
+ const created = (await this.gitlab().createCommit(this.flags.project, request));
66
+ this.logSafe(formatKeyValue([
67
+ ['Created', created.id],
68
+ ['Title', created.title],
69
+ ['URL', created.web_url],
70
+ ]));
71
+ return created;
72
+ }
73
+ }
74
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/gitlab/commit/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAClH,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AASzF,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,aAAwC;IAC/E,MAAM,CAAU,OAAO,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ACH,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { GitLabCommand } from '../../../shared/base-command.js';
2
+ export default class GitlabCommitDiff extends GitLabCommand<typeof GitlabCommitDiff> {
3
+ static readonly summary = "Show the changes a commit made.";
4
+ static readonly description: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ sha: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ stat: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ project: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<unknown>;
12
+ }
@@ -0,0 +1,61 @@
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 { GitLabCommand, projectFlag } from '../../../shared/base-command.js';
18
+ /** GitLab omits a path on the side of the change that does not have one. */
19
+ const UNNAMED = '(unknown)';
20
+ /** How a changed file is introduced above its hunk, so a rename or delete is not read as an edit. */
21
+ function heading(entry) {
22
+ const from = entry.old_path ?? UNNAMED;
23
+ const to = entry.new_path ?? UNNAMED;
24
+ if (entry.deleted_file === true)
25
+ return `deleted ${from}`;
26
+ if (entry.new_file === true)
27
+ return `added ${to}`;
28
+ if (entry.renamed_file === true)
29
+ return `renamed ${from} -> ${to}`;
30
+ return `modified ${to}`;
31
+ }
32
+ export default class GitlabCommitDiff extends GitLabCommand {
33
+ static summary = 'Show the changes a commit made.';
34
+ static description = 'Prints the unified diff for each file the commit touched. GitLab truncates very large diffs ' +
35
+ 'server-side and says so in the payload, so --stat is worth reaching for first on a big commit: ' +
36
+ 'it lists the files without any hunks.';
37
+ static examples = [
38
+ '<%= config.bin %> <%= command.id %> --project group/project --sha 9a1b2c3',
39
+ '<%= config.bin %> <%= command.id %> --project group/project --sha 9a1b2c3 --stat',
40
+ ];
41
+ static flags = {
42
+ ...projectFlag,
43
+ sha: Flags.string({ summary: 'Commit SHA, or the name of a branch or tag.', required: true }),
44
+ stat: Flags.boolean({ summary: 'List the changed files without printing the hunks.', default: false }),
45
+ };
46
+ async run() {
47
+ const entries = (await this.gitlab().getCommitDiff(this.flags.project, this.flags.sha));
48
+ if (!Array.isArray(entries) || entries.length === 0) {
49
+ this.log('This commit changed no files.');
50
+ return entries;
51
+ }
52
+ for (const entry of entries) {
53
+ this.logSafe(heading(entry));
54
+ if (!this.flags.stat && typeof entry.diff === 'string')
55
+ this.logSafe(entry.diff.trimEnd());
56
+ }
57
+ this.log(`\n${entries.length} file(s) changed.`);
58
+ return entries;
59
+ }
60
+ }
61
+ //# sourceMappingURL=diff.js.map