@mittwald/cli 1.5.1 → 1.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.
Files changed (109) hide show
  1. package/dist/commands/app/dependency/list.d.ts +1 -0
  2. package/dist/commands/app/dependency/versions.d.ts +1 -0
  3. package/dist/commands/app/get.js +1 -2
  4. package/dist/commands/app/list-upgrade-candidates.d.ts +1 -0
  5. package/dist/commands/app/list.d.ts +1 -0
  6. package/dist/commands/backup/delete.d.ts +1 -0
  7. package/dist/commands/backup/get.js +1 -2
  8. package/dist/commands/backup/list.d.ts +1 -0
  9. package/dist/commands/backup/schedule/list.d.ts +1 -0
  10. package/dist/commands/container/delete.d.ts +1 -0
  11. package/dist/commands/container/list.d.ts +1 -0
  12. package/dist/commands/container/logs.d.ts +1 -0
  13. package/dist/commands/conversation/categories.d.ts +1 -0
  14. package/dist/commands/conversation/create.d.ts +1 -0
  15. package/dist/commands/conversation/list.d.ts +1 -0
  16. package/dist/commands/conversation/reply.d.ts +1 -0
  17. package/dist/commands/cronjob/delete.d.ts +1 -0
  18. package/dist/commands/cronjob/execution/get.d.ts +1 -1
  19. package/dist/commands/cronjob/execution/list.d.ts +1 -0
  20. package/dist/commands/cronjob/execution/logs.d.ts +1 -0
  21. package/dist/commands/cronjob/get.js +1 -2
  22. package/dist/commands/cronjob/list.d.ts +1 -0
  23. package/dist/commands/database/list.d.ts +1 -0
  24. package/dist/commands/database/mysql/charsets.d.ts +1 -0
  25. package/dist/commands/database/mysql/delete.d.ts +1 -0
  26. package/dist/commands/database/mysql/get.d.ts +1 -1
  27. package/dist/commands/database/mysql/list.d.ts +1 -0
  28. package/dist/commands/database/mysql/user/delete.d.ts +1 -0
  29. package/dist/commands/database/mysql/user/get.d.ts +1 -1
  30. package/dist/commands/database/mysql/user/list.d.ts +1 -0
  31. package/dist/commands/database/mysql/versions.d.ts +1 -0
  32. package/dist/commands/database/redis/get.d.ts +1 -1
  33. package/dist/commands/database/redis/list.d.ts +1 -0
  34. package/dist/commands/database/redis/versions.d.ts +1 -0
  35. package/dist/commands/domain/dnszone/get.js +1 -2
  36. package/dist/commands/domain/dnszone/list.d.ts +1 -0
  37. package/dist/commands/domain/get.js +1 -2
  38. package/dist/commands/domain/list.d.ts +1 -0
  39. package/dist/commands/domain/virtualhost/delete.d.ts +1 -0
  40. package/dist/commands/domain/virtualhost/get.js +1 -2
  41. package/dist/commands/domain/virtualhost/list.d.ts +1 -0
  42. package/dist/commands/extension/list-installed.d.ts +1 -0
  43. package/dist/commands/extension/list.d.ts +1 -0
  44. package/dist/commands/mail/address/delete.d.ts +1 -0
  45. package/dist/commands/mail/address/get.d.ts +1 -1
  46. package/dist/commands/mail/address/list.d.ts +1 -0
  47. package/dist/commands/mail/deliverybox/delete.d.ts +1 -0
  48. package/dist/commands/mail/deliverybox/get.d.ts +1 -1
  49. package/dist/commands/mail/deliverybox/list.d.ts +1 -0
  50. package/dist/commands/org/delete.d.ts +1 -0
  51. package/dist/commands/org/get.js +1 -2
  52. package/dist/commands/org/invite/list-own.d.ts +1 -0
  53. package/dist/commands/org/invite/list.d.ts +1 -0
  54. package/dist/commands/org/list.d.ts +1 -0
  55. package/dist/commands/org/membership/list-own.d.ts +1 -0
  56. package/dist/commands/org/membership/list.d.ts +1 -0
  57. package/dist/commands/project/delete.d.ts +1 -0
  58. package/dist/commands/project/filesystem/usage.js +1 -2
  59. package/dist/commands/project/get.js +1 -2
  60. package/dist/commands/project/invite/get.d.ts +1 -1
  61. package/dist/commands/project/invite/list-own.d.ts +1 -0
  62. package/dist/commands/project/invite/list.d.ts +1 -0
  63. package/dist/commands/project/list.d.ts +1 -0
  64. package/dist/commands/project/membership/get-own.d.ts +1 -0
  65. package/dist/commands/project/membership/get.d.ts +1 -1
  66. package/dist/commands/project/membership/list-own.d.ts +1 -0
  67. package/dist/commands/project/membership/list.d.ts +1 -0
  68. package/dist/commands/registry/delete.d.ts +1 -0
  69. package/dist/commands/registry/list.d.ts +1 -0
  70. package/dist/commands/server/get.d.ts +1 -1
  71. package/dist/commands/server/list.d.ts +1 -0
  72. package/dist/commands/sftp-user/delete.d.ts +1 -0
  73. package/dist/commands/sftp-user/list.d.ts +1 -0
  74. package/dist/commands/ssh-user/delete.d.ts +1 -0
  75. package/dist/commands/ssh-user/list.d.ts +1 -0
  76. package/dist/commands/stack/delete.d.ts +1 -0
  77. package/dist/commands/stack/deploy.js +1 -8
  78. package/dist/commands/stack/list.d.ts +1 -0
  79. package/dist/commands/stack/ps.d.ts +1 -0
  80. package/dist/commands/stack/ps.js +1 -1
  81. package/dist/commands/user/api-token/get.d.ts +1 -1
  82. package/dist/commands/user/api-token/list.d.ts +1 -0
  83. package/dist/commands/user/api-token/revoke.d.ts +1 -0
  84. package/dist/commands/user/get.d.ts +1 -1
  85. package/dist/commands/user/session/get.d.ts +1 -1
  86. package/dist/commands/user/session/list.d.ts +1 -0
  87. package/dist/commands/user/ssh-key/delete.d.ts +1 -0
  88. package/dist/commands/user/ssh-key/get.d.ts +1 -1
  89. package/dist/commands/user/ssh-key/list.d.ts +1 -0
  90. package/dist/lib/basecommands/BaseCommand.d.ts +7 -5
  91. package/dist/lib/basecommands/BaseCommand.js +25 -8
  92. package/dist/lib/basecommands/CommandFlags.d.ts +3 -3
  93. package/dist/lib/basecommands/CoreBaseCommand.d.ts +12 -0
  94. package/dist/lib/basecommands/CoreBaseCommand.js +16 -0
  95. package/dist/lib/basecommands/DeleteBaseCommand.d.ts +1 -0
  96. package/dist/lib/basecommands/DeleteBaseCommand.js +1 -0
  97. package/dist/lib/basecommands/ExecRenderBaseCommand.d.ts +3 -0
  98. package/dist/lib/basecommands/ExecRenderBaseCommand.js +3 -0
  99. package/dist/lib/basecommands/ExtendedBaseCommand.d.ts +3 -0
  100. package/dist/lib/basecommands/ExtendedBaseCommand.js +3 -0
  101. package/dist/lib/basecommands/GetBaseCommand.d.ts +1 -1
  102. package/dist/lib/basecommands/GetBaseCommand.js +1 -0
  103. package/dist/lib/basecommands/ListBaseCommand.d.ts +1 -0
  104. package/dist/lib/basecommands/ListBaseCommand.js +1 -0
  105. package/dist/lib/basecommands/UnauthenticatedBaseCommand.d.ts +10 -0
  106. package/dist/lib/basecommands/UnauthenticatedBaseCommand.js +16 -0
  107. package/dist/lib/resources/stack/enrich.d.ts +2 -2
  108. package/dist/lib/resources/stack/enrich.js +1 -31
  109. package/package.json +8 -8
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { GetBaseCommand } from "../../../lib/basecommands/GetBaseCommand.js";
3
2
  import { projectArgs } from "../../../lib/resources/project/flags.js";
4
3
  import { RenderBaseCommand } from "../../../lib/basecommands/RenderBaseCommand.js";
5
4
  import { usePromise } from "@mittwald/react-use-promise";
@@ -15,7 +14,7 @@ import maybe from "../../../lib/util/maybe.js";
15
14
  export class Usage extends RenderBaseCommand {
16
15
  static description = "Get a project directory filesystem usage.";
17
16
  static flags = {
18
- ...GetBaseCommand.baseFlags,
17
+ ...RenderBaseCommand.buildFlags(),
19
18
  human: Flags.boolean({
20
19
  description: "Display human readable sizes.",
21
20
  }),
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { GetBaseCommand } from "../../lib/basecommands/GetBaseCommand.js";
3
2
  import { projectArgs } from "../../lib/resources/project/flags.js";
4
3
  import { SingleResult, SingleResultTable, } from "../../rendering/react/components/SingleResult.js";
5
4
  import { Box, Text } from "ink";
@@ -67,7 +66,7 @@ const GetProject = ({ response }) => {
67
66
  };
68
67
  export class Get extends RenderBaseCommand {
69
68
  static description = "Get details of a project";
70
- static flags = { ...GetBaseCommand.baseFlags };
69
+ static flags = { ...RenderBaseCommand.buildFlags() };
71
70
  static args = { ...projectArgs };
72
71
  formatter = new GetFormatter(new ComponentPrinter((r) => _jsx(GetProject, { response: r })));
73
72
  render() {
@@ -4,7 +4,7 @@ type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["project"]["getProject
4
4
  export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
5
5
  static description: string;
6
6
  static flags: {
7
- [x: string]: import("@oclif/core/interfaces").Flag<any>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  };
9
9
  static args: {
10
10
  "invite-id": import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -14,6 +14,7 @@ export default class List extends ListBaseCommand<typeof List, ResponseItem, Res
14
14
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
17
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
18
  };
18
19
  getData(): Promise<Response>;
19
20
  protected getColumns(): ListColumns<ResponseItem>;
@@ -15,6 +15,7 @@ export default class List extends ListBaseCommand<typeof List, ResponseItem, Res
15
15
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
17
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
18
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
19
  };
19
20
  getData(): Promise<Response>;
20
21
  protected getColumns(): ListColumns<ResponseItem>;
@@ -14,6 +14,7 @@ export declare class List extends ListBaseCommand<typeof List, ProjectResponseIt
14
14
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
17
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
18
  };
18
19
  getData(): Promise<Response>;
19
20
  protected getColumns(ignoredData: ProjectResponseItem[]): ListColumns<ProjectResponseItem>;
@@ -5,6 +5,7 @@ export default class GetOwn extends GetBaseCommand<typeof GetOwn, APIResponse> {
5
5
  static description: string;
6
6
  static flags: {
7
7
  "project-id": import("@oclif/core/interfaces").OptionFlag<string>;
8
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  };
9
10
  static args: {};
10
11
  protected getData(): Promise<APIResponse>;
@@ -4,7 +4,7 @@ type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["project"]["getProject
4
4
  export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
5
5
  static description: string;
6
6
  static flags: {
7
- [x: string]: import("@oclif/core/interfaces").Flag<any>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  };
9
9
  static args: {
10
10
  "membership-id": import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -14,6 +14,7 @@ export default class ListOwn extends ListBaseCommand<typeof ListOwn, ResponseIte
14
14
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
17
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
18
  };
18
19
  getData(): Promise<Response>;
19
20
  protected getColumns(): ListColumns<ResponseItem>;
@@ -18,6 +18,7 @@ export default class List extends ListBaseCommand<typeof List, ResponseItem, Res
18
18
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
19
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
20
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
21
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
22
  };
22
23
  getData(): Promise<Response>;
23
24
  protected mapData(data: SuccessfulResponse<Response, 200>["data"]): Promise<({
@@ -5,6 +5,7 @@ export default class Delete extends DeleteBaseCommand<typeof Delete> {
5
5
  static flags: {
6
6
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
7
  quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  };
9
10
  static args: {
10
11
  "registry-id": import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -16,6 +16,7 @@ export declare class List extends ListBaseCommand<typeof List, ResponseItem, Res
16
16
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
17
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
18
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
19
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
20
  };
20
21
  getData(): Promise<Response>;
21
22
  protected getColumns(data: ResponseItem[]): ListColumns<ResponseItem>;
@@ -4,7 +4,7 @@ type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["project"]["getServer"
4
4
  export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
5
5
  static description: string;
6
6
  static flags: {
7
- [x: string]: import("@oclif/core/interfaces").Flag<any>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  };
9
9
  static args: {
10
10
  "server-id": import("@oclif/core/interfaces").Arg<string>;
@@ -14,6 +14,7 @@ export default class List extends ListBaseCommand<typeof List, ResponseItem, Res
14
14
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
17
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
18
  };
18
19
  getData(): Promise<Response>;
19
20
  protected getColumns(ignoredData: ResponseItem[]): ListColumns<ResponseItem>;
@@ -5,6 +5,7 @@ export default class Delete extends DeleteBaseCommand<typeof Delete> {
5
5
  static flags: {
6
6
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
7
  quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  };
9
10
  static args: {
10
11
  "sftp-user-id": import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -15,6 +15,7 @@ export default class List extends ListBaseCommand<typeof List, SftpUserResponseI
15
15
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
17
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
18
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
19
  };
19
20
  static aliases: string[];
20
21
  static deprecateAliases: boolean;
@@ -5,6 +5,7 @@ export default class Delete extends DeleteBaseCommand<typeof Delete> {
5
5
  static flags: {
6
6
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
7
  quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  };
9
10
  static args: {
10
11
  "ssh-user-id": import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -15,6 +15,7 @@ export declare class List extends ListBaseCommand<typeof List, SshUserResponseIt
15
15
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
17
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
18
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
19
  };
19
20
  static aliases: string[];
20
21
  static deprecateAliases: boolean;
@@ -7,6 +7,7 @@ export default class Delete extends DeleteBaseCommand<typeof Delete> {
7
7
  "with-volumes": import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
8
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
9
  quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  };
11
12
  static args: {
12
13
  "stack-id": import("@oclif/core/interfaces").Arg<string>;
@@ -32,17 +32,10 @@ export class Deploy extends ExecRenderBaseCommand {
32
32
  const { "compose-file": composeFile, "env-file": envFile } = this.flags;
33
33
  const r = makeProcessRenderer(this.flags, "Deploying container stack");
34
34
  const result = { restartedServices: [] };
35
- const stack = await r.runStep("getting stack", async () => {
36
- const resp = await this.apiClient.container.getStack({ stackId });
37
- assertStatus(resp, 200);
38
- return resp.data;
39
- });
40
35
  const env = await collectEnvironment(process.env, envFile);
41
36
  let stackDefinition = await loadStackFromFile(composeFile, env);
42
37
  stackDefinition = sanitizeStackDefinition(stackDefinition);
43
- stackDefinition = await r.runStep("getting image configurations", async () => {
44
- return enrichStackDefinition(this.apiClient, stack.projectId, stackDefinition);
45
- });
38
+ stackDefinition = await r.runStep("getting image configurations", () => enrichStackDefinition(stackDefinition));
46
39
  this.debug("complete stack definition: %O", stackDefinition);
47
40
  const declaredStack = await r.runStep("deploying stack", async () => {
48
41
  const resp = await this.apiClient.container.declareStack({
@@ -17,6 +17,7 @@ export declare class List extends ListBaseCommand<typeof List, ListItem, ListRes
17
17
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
18
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
19
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
20
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
21
  };
21
22
  getData(): Promise<ListResponse>;
22
23
  protected getColumns(data: ListItem[]): ListColumns<ListItem>;
@@ -16,6 +16,7 @@ export declare class ListContainers extends ListBaseCommand<typeof ListContainer
16
16
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
17
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
18
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
19
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
20
  };
20
21
  getData(): Promise<ListItem[]>;
21
22
  protected getColumns(data: ListItem[]): ListColumns<ListItem>;
@@ -29,7 +29,7 @@ export class ListContainers extends ListBaseCommand {
29
29
  get: (svc) => svc.deployedState.image,
30
30
  },
31
31
  command: {
32
- get: (svc) => svc.deployedState.command?.join(" "),
32
+ get: (svc) => svc.deployedState.command?.join(" ") ?? "(from image)",
33
33
  },
34
34
  description: {},
35
35
  ports: {
@@ -4,7 +4,7 @@ type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["user"]["getApiToken"]
4
4
  export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
5
5
  static description: string;
6
6
  static flags: {
7
- [x: string]: import("@oclif/core/interfaces").Flag<any>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  };
9
9
  static args: {
10
10
  "token-id": import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -14,6 +14,7 @@ export default class List extends ListBaseCommand<typeof List, ResponseItem, Res
14
14
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
17
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
18
  };
18
19
  getData(): Promise<Response>;
19
20
  protected getColumns(): ListColumns<ResponseItem>;
@@ -8,6 +8,7 @@ export default class Revoke extends DeleteBaseCommand<typeof Revoke> {
8
8
  static flags: {
9
9
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
10
  quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  };
12
13
  protected deleteResource(): Promise<void>;
13
14
  }
@@ -5,7 +5,7 @@ type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["user"]["getUser"]>>;
5
5
  export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
6
6
  static description: string;
7
7
  static flags: {
8
- [x: string]: import("@oclif/core/interfaces").Flag<any>;
8
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
9
  };
10
10
  static args: {
11
11
  "user-id": import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -4,7 +4,7 @@ type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["user"]["getSession"]>
4
4
  export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
5
5
  static description: string;
6
6
  static flags: {
7
- [x: string]: import("@oclif/core/interfaces").Flag<any>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  };
9
9
  static args: {
10
10
  "token-id": import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -14,6 +14,7 @@ export default class List extends ListBaseCommand<typeof List, ResponseItem, Res
14
14
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
15
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
17
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
18
  };
18
19
  getData(): Promise<Response>;
19
20
  protected getColumns(): ListColumns<ResponseItem>;
@@ -8,6 +8,7 @@ export default class Delete extends DeleteBaseCommand<typeof Delete> {
8
8
  static flags: {
9
9
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
10
  quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  };
12
13
  protected deleteResource(): Promise<void>;
13
14
  }
@@ -4,7 +4,7 @@ type APIResponse = Awaited<ReturnType<MittwaldAPIV2Client["user"]["getSshKey"]>>
4
4
  export default class Get extends GetBaseCommand<typeof Get, APIResponse> {
5
5
  static description: string;
6
6
  static flags: {
7
- [x: string]: import("@oclif/core/interfaces").Flag<any>;
7
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  };
9
9
  static args: {
10
10
  "key-id": import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
@@ -15,6 +15,7 @@ export default class List extends ListBaseCommand<typeof List, ResponseItem, Res
15
15
  "no-truncate": import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  "no-relative-dates": import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
17
  "csv-separator": import("@oclif/core/interfaces").OptionFlag<"," | ";">;
18
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
19
  };
19
20
  getData(): Promise<Response>;
20
21
  protected mapData(data: SuccessfulResponse<Response, 200>["data"]): MittwaldAPIV2.Components.Schemas.SignupSshKey[];
@@ -1,7 +1,9 @@
1
- import { Command } from "@oclif/core";
2
- import { MittwaldAPIV2Client } from "@mittwald/api-client";
3
- export declare abstract class BaseCommand extends Command {
4
- protected authenticationRequired: boolean;
5
- protected apiClient: MittwaldAPIV2Client;
1
+ import { CoreBaseCommand } from "./CoreBaseCommand.js";
2
+ /** Base command class for authenticated commands that includes the --token flag. */
3
+ export declare abstract class BaseCommand extends CoreBaseCommand {
4
+ static baseFlags: {
5
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ };
6
7
  init(): Promise<void>;
8
+ private getEffectiveTokenWithFlag;
7
9
  }
@@ -1,18 +1,27 @@
1
- import { Command } from "@oclif/core";
1
+ import { Flags } from "@oclif/core";
2
2
  import { MittwaldAPIV2Client } from "@mittwald/api-client";
3
- import { configureAxiosRetry } from "../apiutil/api_retry.js";
4
- import { configureConsistencyHandling } from "../apiutil/api_consistency.js";
5
3
  import { getTokenFilename, readApiToken } from "../auth/token.js";
4
+ import { CoreBaseCommand } from "./CoreBaseCommand.js";
6
5
  import { configureAxiosLogging } from "../apiutil/api_logging.js";
7
- export class BaseCommand extends Command {
8
- authenticationRequired = true;
9
- apiClient = MittwaldAPIV2Client.newUnauthenticated();
6
+ import { configureAxiosRetry } from "../apiutil/api_retry.js";
7
+ import { configureConsistencyHandling } from "../apiutil/api_consistency.js";
8
+ /** Base command class for authenticated commands that includes the --token flag. */
9
+ export class BaseCommand extends CoreBaseCommand {
10
+ static baseFlags = {
11
+ token: Flags.string({
12
+ description: "API token to use for authentication (overrides environment and config file). NOTE: watch out that tokens passed via this flag might be logged in your shell history.",
13
+ required: false,
14
+ helpGroup: "AUTHENTICATION",
15
+ }),
16
+ };
10
17
  async init() {
11
18
  await super.init();
19
+ // Override the parent's auth behavior to include --token flag support
12
20
  if (this.authenticationRequired) {
13
- const token = await readApiToken(this.config);
21
+ const { flags } = await this.parse();
22
+ const token = await this.getEffectiveTokenWithFlag(flags);
14
23
  if (token === undefined) {
15
- throw new Error(`Could not get token from either config file (${getTokenFilename(this.config)}) or environment`);
24
+ throw new Error(`Could not get token from --token flag, MITTWALD_API_TOKEN env var, or config file (${getTokenFilename(this.config)}). Please run "mw login token" or use --token.`);
16
25
  }
17
26
  this.apiClient = MittwaldAPIV2Client.newWithToken(token);
18
27
  this.apiClient.axios.defaults.headers["User-Agent"] =
@@ -22,4 +31,12 @@ export class BaseCommand extends Command {
22
31
  configureConsistencyHandling(this.apiClient.axios);
23
32
  }
24
33
  }
34
+ async getEffectiveTokenWithFlag(flags) {
35
+ // 1. Check --token flag first (highest precedence)
36
+ if (flags.token) {
37
+ return flags.token;
38
+ }
39
+ // 2. Fall back to existing readApiToken logic (env then file)
40
+ return await readApiToken(this.config);
41
+ }
25
42
  }
@@ -1,6 +1,6 @@
1
- import { BaseCommand } from "./BaseCommand.js";
1
+ import { CoreBaseCommand } from "./CoreBaseCommand.js";
2
2
  import { Interfaces } from "@oclif/core";
3
3
  /** CommandFlags is a helper type that extracts the flags from a command class. */
4
- export type CommandFlags<T extends typeof BaseCommand> = Interfaces.InferredFlags<T["flags"]>;
4
+ export type CommandFlags<T extends typeof CoreBaseCommand> = Interfaces.InferredFlags<T["flags"]>;
5
5
  /** CommandArgs is a helper type that extracts the args from a command class. */
6
- export type CommandArgs<T extends typeof BaseCommand> = Interfaces.InferredArgs<T["args"]>;
6
+ export type CommandArgs<T extends typeof CoreBaseCommand> = Interfaces.InferredArgs<T["args"]>;
@@ -0,0 +1,12 @@
1
+ import { Command } from "@oclif/core";
2
+ import { MittwaldAPIV2Client } from "@mittwald/api-client";
3
+ /**
4
+ * Core base command class that provides common functionality but no
5
+ * authentication flags. This is the base for both authenticated and
6
+ * unauthenticated command hierarchies.
7
+ */
8
+ export declare abstract class CoreBaseCommand extends Command {
9
+ protected authenticationRequired: boolean;
10
+ protected apiClient: MittwaldAPIV2Client;
11
+ protected getEffectiveToken(): Promise<string | undefined>;
12
+ }
@@ -0,0 +1,16 @@
1
+ import { Command } from "@oclif/core";
2
+ import { MittwaldAPIV2Client } from "@mittwald/api-client";
3
+ import { readApiToken } from "../auth/token.js";
4
+ /**
5
+ * Core base command class that provides common functionality but no
6
+ * authentication flags. This is the base for both authenticated and
7
+ * unauthenticated command hierarchies.
8
+ */
9
+ export class CoreBaseCommand extends Command {
10
+ authenticationRequired = true;
11
+ apiClient = MittwaldAPIV2Client.newUnauthenticated();
12
+ async getEffectiveToken() {
13
+ // Only check env and file - no --token flag in this base class
14
+ return await readApiToken(this.config);
15
+ }
16
+ }
@@ -5,6 +5,7 @@ export declare abstract class DeleteBaseCommand<T extends typeof BaseCommand> ex
5
5
  static baseFlags: {
6
6
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
7
  quiet: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  };
9
10
  protected exec(): Promise<void>;
10
11
  protected render(): null;
@@ -7,6 +7,7 @@ import { Text } from "ink";
7
7
  export class DeleteBaseCommand extends ExecRenderBaseCommand {
8
8
  static resourceName = "object";
9
9
  static baseFlags = {
10
+ ...ExecRenderBaseCommand.baseFlags,
10
11
  ...processFlags,
11
12
  force: Flags.boolean({
12
13
  char: "f",
@@ -2,6 +2,9 @@ import { BaseCommand } from "./BaseCommand.js";
2
2
  import { ReactNode } from "react";
3
3
  import { ExtendedBaseCommand } from "./ExtendedBaseCommand.js";
4
4
  export declare abstract class ExecRenderBaseCommand<T extends typeof BaseCommand, TRes> extends ExtendedBaseCommand<T> {
5
+ static baseFlags: {
6
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ };
5
8
  protected abstract exec(): Promise<TRes>;
6
9
  run(): Promise<void>;
7
10
  protected abstract render(executionResult: TRes): ReactNode;
@@ -14,6 +14,9 @@ function wrapRender(fn) {
14
14
  };
15
15
  }
16
16
  export class ExecRenderBaseCommand extends ExtendedBaseCommand {
17
+ static baseFlags = {
18
+ ...ExtendedBaseCommand.baseFlags,
19
+ };
17
20
  async run() {
18
21
  const result = await this.exec();
19
22
  const wrappedRender = wrapRender(this.render.bind(this));
@@ -2,6 +2,9 @@ import { BaseCommand } from "./BaseCommand.js";
2
2
  import { CommandArgs, CommandFlags } from "./CommandFlags.js";
3
3
  import { CommandType } from "../context/FlagSetBuilder.js";
4
4
  export declare abstract class ExtendedBaseCommand<T extends typeof BaseCommand> extends BaseCommand {
5
+ static baseFlags: {
6
+ token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ };
5
8
  protected flags: CommandFlags<T>;
6
9
  protected args: CommandArgs<T>;
7
10
  init(): Promise<void>;
@@ -4,6 +4,9 @@ import { withProjectId } from "../resources/project/flags.js";
4
4
  import { withServerId } from "../resources/server/flags.js";
5
5
  import { withStackId } from "../resources/stack/flags.js";
6
6
  export class ExtendedBaseCommand extends BaseCommand {
7
+ static baseFlags = {
8
+ ...BaseCommand.baseFlags,
9
+ };
7
10
  flags;
8
11
  args;
9
12
  async init() {
@@ -7,7 +7,7 @@ export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof G
7
7
  export type Args<T extends typeof Command> = Interfaces.InferredArgs<T["args"]>;
8
8
  export declare abstract class GetBaseCommand<T extends typeof BaseCommand, TAPIResponse extends Response> extends ExtendedBaseCommand<T> {
9
9
  static baseFlags: {
10
- [x: string]: Interfaces.Flag<any>;
10
+ token: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
11
11
  };
12
12
  protected formatter: GetFormatter;
13
13
  init(): Promise<void>;
@@ -3,6 +3,7 @@ import { ExtendedBaseCommand } from "./ExtendedBaseCommand.js";
3
3
  import { GetFormatter } from "../../rendering/formatter/GetFormatter.js";
4
4
  export class GetBaseCommand extends ExtendedBaseCommand {
5
5
  static baseFlags = {
6
+ ...ExtendedBaseCommand.baseFlags,
6
7
  ...GetFormatter.flags,
7
8
  };
8
9
  formatter = new GetFormatter();
@@ -19,6 +19,7 @@ export declare abstract class ListBaseCommand<T extends typeof BaseCommand, TIte
19
19
  "no-truncate": Interfaces.BooleanFlag<boolean>;
20
20
  "no-relative-dates": Interfaces.BooleanFlag<boolean>;
21
21
  "csv-separator": Interfaces.OptionFlag<"," | ";">;
22
+ token: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
22
23
  };
23
24
  protected formatter: ListFormatter;
24
25
  protected sorter?: SorterFunction<TItem>;
@@ -4,6 +4,7 @@ import { ExtendedBaseCommand } from "./ExtendedBaseCommand.js";
4
4
  import ListDateColumnFormatter, { isResourceWithCreatedAt, } from "../../rendering/formatter/ListDateColumnFormatter.js";
5
5
  export class ListBaseCommand extends ExtendedBaseCommand {
6
6
  static baseFlags = {
7
+ ...ExtendedBaseCommand.baseFlags,
7
8
  ...ListFormatter.flags,
8
9
  };
9
10
  formatter = new ListFormatter();
@@ -0,0 +1,10 @@
1
+ import { CoreBaseCommand } from "./CoreBaseCommand.js";
2
+ /**
3
+ * Base command class for commands that do not require authentication. This
4
+ * class extends CoreBaseCommand directly, bypassing the --token flag from
5
+ * BaseCommand.
6
+ */
7
+ export declare abstract class UnauthenticatedBaseCommand extends CoreBaseCommand {
8
+ protected authenticationRequired: boolean;
9
+ init(): Promise<void>;
10
+ }
@@ -0,0 +1,16 @@
1
+ import { CoreBaseCommand } from "./CoreBaseCommand.js";
2
+ import { MittwaldAPIV2Client } from "@mittwald/api-client";
3
+ /**
4
+ * Base command class for commands that do not require authentication. This
5
+ * class extends CoreBaseCommand directly, bypassing the --token flag from
6
+ * BaseCommand.
7
+ */
8
+ export class UnauthenticatedBaseCommand extends CoreBaseCommand {
9
+ // No baseFlags defined - we don't want the --token flag for these commands
10
+ authenticationRequired = false;
11
+ async init() {
12
+ await super.init();
13
+ // For unauthenticated commands, keep the unauthenticated API client
14
+ this.apiClient = this.apiClient || MittwaldAPIV2Client.newUnauthenticated();
15
+ }
16
+ }
@@ -1,4 +1,4 @@
1
- import { type MittwaldAPIV2, MittwaldAPIV2Client } from "@mittwald/api-client";
1
+ import { type MittwaldAPIV2 } from "@mittwald/api-client";
2
2
  type StackRequest = MittwaldAPIV2.Paths.V2StacksStackId.Put.Parameters.RequestBody;
3
- export declare function enrichStackDefinition(apiClient: MittwaldAPIV2Client, projectId: string, input: StackRequest): Promise<StackRequest>;
3
+ export declare function enrichStackDefinition(input: StackRequest): Promise<StackRequest>;
4
4
  export {};