@studiometa/forge-cli 0.0.1 → 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 (193) hide show
  1. package/README.md +236 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +2746 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/backups/command.d.ts +2 -0
  7. package/dist/commands/backups/command.d.ts.map +1 -0
  8. package/dist/commands/backups/handlers.d.ts +6 -0
  9. package/dist/commands/backups/handlers.d.ts.map +1 -0
  10. package/dist/commands/backups/help.d.ts +2 -0
  11. package/dist/commands/backups/help.d.ts.map +1 -0
  12. package/dist/commands/backups/index.d.ts +3 -0
  13. package/dist/commands/backups/index.d.ts.map +1 -0
  14. package/dist/commands/certificates/command.d.ts +2 -0
  15. package/dist/commands/certificates/command.d.ts.map +1 -0
  16. package/dist/commands/certificates/handlers.d.ts +5 -0
  17. package/dist/commands/certificates/handlers.d.ts.map +1 -0
  18. package/dist/commands/certificates/help.d.ts +2 -0
  19. package/dist/commands/certificates/help.d.ts.map +1 -0
  20. package/dist/commands/certificates/index.d.ts +3 -0
  21. package/dist/commands/certificates/index.d.ts.map +1 -0
  22. package/dist/commands/commands/command.d.ts +2 -0
  23. package/dist/commands/commands/command.d.ts.map +1 -0
  24. package/dist/commands/commands/handlers.d.ts +5 -0
  25. package/dist/commands/commands/handlers.d.ts.map +1 -0
  26. package/dist/commands/commands/help.d.ts +2 -0
  27. package/dist/commands/commands/help.d.ts.map +1 -0
  28. package/dist/commands/commands/index.d.ts +3 -0
  29. package/dist/commands/commands/index.d.ts.map +1 -0
  30. package/dist/commands/config.d.ts +6 -0
  31. package/dist/commands/config.d.ts.map +1 -0
  32. package/dist/commands/daemons/command.d.ts +2 -0
  33. package/dist/commands/daemons/command.d.ts.map +1 -0
  34. package/dist/commands/daemons/handlers.d.ts +5 -0
  35. package/dist/commands/daemons/handlers.d.ts.map +1 -0
  36. package/dist/commands/daemons/help.d.ts +2 -0
  37. package/dist/commands/daemons/help.d.ts.map +1 -0
  38. package/dist/commands/daemons/index.d.ts +3 -0
  39. package/dist/commands/daemons/index.d.ts.map +1 -0
  40. package/dist/commands/database-users/command.d.ts +2 -0
  41. package/dist/commands/database-users/command.d.ts.map +1 -0
  42. package/dist/commands/database-users/handlers.d.ts +6 -0
  43. package/dist/commands/database-users/handlers.d.ts.map +1 -0
  44. package/dist/commands/database-users/help.d.ts +2 -0
  45. package/dist/commands/database-users/help.d.ts.map +1 -0
  46. package/dist/commands/database-users/index.d.ts +3 -0
  47. package/dist/commands/database-users/index.d.ts.map +1 -0
  48. package/dist/commands/databases/command.d.ts +2 -0
  49. package/dist/commands/databases/command.d.ts.map +1 -0
  50. package/dist/commands/databases/handlers.d.ts +4 -0
  51. package/dist/commands/databases/handlers.d.ts.map +1 -0
  52. package/dist/commands/databases/help.d.ts +2 -0
  53. package/dist/commands/databases/help.d.ts.map +1 -0
  54. package/dist/commands/databases/index.d.ts +3 -0
  55. package/dist/commands/databases/index.d.ts.map +1 -0
  56. package/dist/commands/deployments/command.d.ts +2 -0
  57. package/dist/commands/deployments/command.d.ts.map +1 -0
  58. package/dist/commands/deployments/handlers.d.ts +4 -0
  59. package/dist/commands/deployments/handlers.d.ts.map +1 -0
  60. package/dist/commands/deployments/help.d.ts +2 -0
  61. package/dist/commands/deployments/help.d.ts.map +1 -0
  62. package/dist/commands/deployments/index.d.ts +3 -0
  63. package/dist/commands/deployments/index.d.ts.map +1 -0
  64. package/dist/commands/env/command.d.ts +2 -0
  65. package/dist/commands/env/command.d.ts.map +1 -0
  66. package/dist/commands/env/handlers.d.ts +4 -0
  67. package/dist/commands/env/handlers.d.ts.map +1 -0
  68. package/dist/commands/env/help.d.ts +2 -0
  69. package/dist/commands/env/help.d.ts.map +1 -0
  70. package/dist/commands/env/index.d.ts +3 -0
  71. package/dist/commands/env/index.d.ts.map +1 -0
  72. package/dist/commands/firewall-rules/command.d.ts +2 -0
  73. package/dist/commands/firewall-rules/command.d.ts.map +1 -0
  74. package/dist/commands/firewall-rules/handlers.d.ts +4 -0
  75. package/dist/commands/firewall-rules/handlers.d.ts.map +1 -0
  76. package/dist/commands/firewall-rules/help.d.ts +2 -0
  77. package/dist/commands/firewall-rules/help.d.ts.map +1 -0
  78. package/dist/commands/firewall-rules/index.d.ts +3 -0
  79. package/dist/commands/firewall-rules/index.d.ts.map +1 -0
  80. package/dist/commands/monitors/command.d.ts +2 -0
  81. package/dist/commands/monitors/command.d.ts.map +1 -0
  82. package/dist/commands/monitors/handlers.d.ts +6 -0
  83. package/dist/commands/monitors/handlers.d.ts.map +1 -0
  84. package/dist/commands/monitors/help.d.ts +2 -0
  85. package/dist/commands/monitors/help.d.ts.map +1 -0
  86. package/dist/commands/monitors/index.d.ts +3 -0
  87. package/dist/commands/monitors/index.d.ts.map +1 -0
  88. package/dist/commands/nginx/command.d.ts +2 -0
  89. package/dist/commands/nginx/command.d.ts.map +1 -0
  90. package/dist/commands/nginx/handlers.d.ts +4 -0
  91. package/dist/commands/nginx/handlers.d.ts.map +1 -0
  92. package/dist/commands/nginx/help.d.ts +2 -0
  93. package/dist/commands/nginx/help.d.ts.map +1 -0
  94. package/dist/commands/nginx/index.d.ts +3 -0
  95. package/dist/commands/nginx/index.d.ts.map +1 -0
  96. package/dist/commands/nginx-templates/command.d.ts +2 -0
  97. package/dist/commands/nginx-templates/command.d.ts.map +1 -0
  98. package/dist/commands/nginx-templates/handlers.d.ts +7 -0
  99. package/dist/commands/nginx-templates/handlers.d.ts.map +1 -0
  100. package/dist/commands/nginx-templates/help.d.ts +2 -0
  101. package/dist/commands/nginx-templates/help.d.ts.map +1 -0
  102. package/dist/commands/nginx-templates/index.d.ts +3 -0
  103. package/dist/commands/nginx-templates/index.d.ts.map +1 -0
  104. package/dist/commands/recipes/command.d.ts +2 -0
  105. package/dist/commands/recipes/command.d.ts.map +1 -0
  106. package/dist/commands/recipes/handlers.d.ts +5 -0
  107. package/dist/commands/recipes/handlers.d.ts.map +1 -0
  108. package/dist/commands/recipes/help.d.ts +2 -0
  109. package/dist/commands/recipes/help.d.ts.map +1 -0
  110. package/dist/commands/recipes/index.d.ts +3 -0
  111. package/dist/commands/recipes/index.d.ts.map +1 -0
  112. package/dist/commands/redirect-rules/command.d.ts +2 -0
  113. package/dist/commands/redirect-rules/command.d.ts.map +1 -0
  114. package/dist/commands/redirect-rules/handlers.d.ts +6 -0
  115. package/dist/commands/redirect-rules/handlers.d.ts.map +1 -0
  116. package/dist/commands/redirect-rules/help.d.ts +2 -0
  117. package/dist/commands/redirect-rules/help.d.ts.map +1 -0
  118. package/dist/commands/redirect-rules/index.d.ts +3 -0
  119. package/dist/commands/redirect-rules/index.d.ts.map +1 -0
  120. package/dist/commands/scheduled-jobs/command.d.ts +2 -0
  121. package/dist/commands/scheduled-jobs/command.d.ts.map +1 -0
  122. package/dist/commands/scheduled-jobs/handlers.d.ts +6 -0
  123. package/dist/commands/scheduled-jobs/handlers.d.ts.map +1 -0
  124. package/dist/commands/scheduled-jobs/help.d.ts +2 -0
  125. package/dist/commands/scheduled-jobs/help.d.ts.map +1 -0
  126. package/dist/commands/scheduled-jobs/index.d.ts +3 -0
  127. package/dist/commands/scheduled-jobs/index.d.ts.map +1 -0
  128. package/dist/commands/security-rules/command.d.ts +2 -0
  129. package/dist/commands/security-rules/command.d.ts.map +1 -0
  130. package/dist/commands/security-rules/handlers.d.ts +6 -0
  131. package/dist/commands/security-rules/handlers.d.ts.map +1 -0
  132. package/dist/commands/security-rules/help.d.ts +2 -0
  133. package/dist/commands/security-rules/help.d.ts.map +1 -0
  134. package/dist/commands/security-rules/index.d.ts +3 -0
  135. package/dist/commands/security-rules/index.d.ts.map +1 -0
  136. package/dist/commands/servers/command.d.ts +2 -0
  137. package/dist/commands/servers/command.d.ts.map +1 -0
  138. package/dist/commands/servers/handlers.d.ts +18 -0
  139. package/dist/commands/servers/handlers.d.ts.map +1 -0
  140. package/dist/commands/servers/help.d.ts +2 -0
  141. package/dist/commands/servers/help.d.ts.map +1 -0
  142. package/dist/commands/servers/index.d.ts +3 -0
  143. package/dist/commands/servers/index.d.ts.map +1 -0
  144. package/dist/commands/sites/command.d.ts +2 -0
  145. package/dist/commands/sites/command.d.ts.map +1 -0
  146. package/dist/commands/sites/handlers.d.ts +4 -0
  147. package/dist/commands/sites/handlers.d.ts.map +1 -0
  148. package/dist/commands/sites/help.d.ts +2 -0
  149. package/dist/commands/sites/help.d.ts.map +1 -0
  150. package/dist/commands/sites/index.d.ts +3 -0
  151. package/dist/commands/sites/index.d.ts.map +1 -0
  152. package/dist/commands/ssh-keys/command.d.ts +2 -0
  153. package/dist/commands/ssh-keys/command.d.ts.map +1 -0
  154. package/dist/commands/ssh-keys/handlers.d.ts +4 -0
  155. package/dist/commands/ssh-keys/handlers.d.ts.map +1 -0
  156. package/dist/commands/ssh-keys/help.d.ts +2 -0
  157. package/dist/commands/ssh-keys/help.d.ts.map +1 -0
  158. package/dist/commands/ssh-keys/index.d.ts +3 -0
  159. package/dist/commands/ssh-keys/index.d.ts.map +1 -0
  160. package/dist/commands/user/command.d.ts +2 -0
  161. package/dist/commands/user/command.d.ts.map +1 -0
  162. package/dist/commands/user/handlers.d.ts +3 -0
  163. package/dist/commands/user/handlers.d.ts.map +1 -0
  164. package/dist/commands/user/help.d.ts +2 -0
  165. package/dist/commands/user/help.d.ts.map +1 -0
  166. package/dist/commands/user/index.d.ts +3 -0
  167. package/dist/commands/user/index.d.ts.map +1 -0
  168. package/dist/config.d.ts +18 -0
  169. package/dist/config.d.ts.map +1 -0
  170. package/dist/context.d.ts +50 -0
  171. package/dist/context.d.ts.map +1 -0
  172. package/dist/error-handler-BahHMt6t.js +396 -0
  173. package/dist/error-handler-BahHMt6t.js.map +1 -0
  174. package/dist/error-handler.d.ts +39 -0
  175. package/dist/error-handler.d.ts.map +1 -0
  176. package/dist/errors.d.ts +45 -0
  177. package/dist/errors.d.ts.map +1 -0
  178. package/dist/index.d.ts +8 -0
  179. package/dist/index.d.ts.map +1 -0
  180. package/dist/index.js +2 -0
  181. package/dist/output.d.ts +47 -0
  182. package/dist/output.d.ts.map +1 -0
  183. package/dist/types.d.ts +7 -0
  184. package/dist/types.d.ts.map +1 -0
  185. package/dist/utils/args.d.ts +14 -0
  186. package/dist/utils/args.d.ts.map +1 -0
  187. package/dist/utils/colors.d.ts +17 -0
  188. package/dist/utils/colors.d.ts.map +1 -0
  189. package/dist/utils/command-router.d.ts +47 -0
  190. package/dist/utils/command-router.d.ts.map +1 -0
  191. package/dist/utils/resolve.d.ts +25 -0
  192. package/dist/utils/resolve.d.ts.map +1 -0
  193. package/package.json +41 -1
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Error types for forge-cli.
3
+ *
4
+ * Provides specific error types for different failure scenarios with
5
+ * recovery hints for both humans and AI agents.
6
+ */
7
+ /**
8
+ * Base error class for all CLI errors.
9
+ */
10
+ export declare abstract class CliError extends Error {
11
+ readonly hints?: string[] | undefined;
12
+ readonly cause?: unknown | undefined;
13
+ abstract readonly code: string;
14
+ abstract readonly isRecoverable: boolean;
15
+ constructor(message: string, hints?: string[] | undefined, cause?: unknown | undefined);
16
+ toJSON(): Record<string, unknown>;
17
+ toFormattedMessage(): string;
18
+ }
19
+ export declare class ConfigError extends CliError {
20
+ readonly code = "CONFIG_ERROR";
21
+ readonly isRecoverable = true;
22
+ static missingToken(): ConfigError;
23
+ }
24
+ export declare class ValidationError extends CliError {
25
+ readonly field?: string | undefined;
26
+ readonly code = "VALIDATION_ERROR";
27
+ readonly isRecoverable = true;
28
+ constructor(message: string, field?: string | undefined, hints?: string[], cause?: unknown);
29
+ toJSON(): {
30
+ field: string | undefined;
31
+ };
32
+ static required(field: string, hints?: string[]): ValidationError;
33
+ }
34
+ export declare class ApiError extends CliError {
35
+ readonly statusCode?: number | undefined;
36
+ readonly code = "API_ERROR";
37
+ readonly isRecoverable: boolean;
38
+ constructor(message: string, statusCode?: number | undefined, hints?: string[], cause?: unknown);
39
+ toJSON(): {
40
+ statusCode: number | undefined;
41
+ };
42
+ static fromForgeError(error: unknown): ApiError;
43
+ }
44
+ export declare function isCliError(error: unknown): error is CliError;
45
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,8BAAsB,QAAS,SAAQ,KAAK;aAMxB,KAAK,CAAC,EAAE,MAAM,EAAE;aAChB,KAAK,CAAC,EAAE,OAAO;IANjC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;gBAGvC,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,EAAE,MAAM,EAAE,YAAA,EAChB,KAAK,CAAC,EAAE,OAAO,YAAA;IAQjC,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAWjC,kBAAkB,IAAI,MAAM;CAO7B;AAID,qBAAa,WAAY,SAAQ,QAAQ;IACvC,QAAQ,CAAC,IAAI,kBAAkB;IAC/B,QAAQ,CAAC,aAAa,QAAQ;IAE9B,MAAM,CAAC,YAAY,IAAI,WAAW;CAOnC;AAID,qBAAa,eAAgB,SAAQ,QAAQ;aAMzB,KAAK,CAAC,EAAE,MAAM;IALhC,QAAQ,CAAC,IAAI,sBAAsB;IACnC,QAAQ,CAAC,aAAa,QAAQ;gBAG5B,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,EAAE,MAAM,YAAA,EAC9B,KAAK,CAAC,EAAE,MAAM,EAAE,EAChB,KAAK,CAAC,EAAE,OAAO;IAKR,MAAM;;;IAIf,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,eAAe;CAGlE;AAID,qBAAa,QAAS,SAAQ,QAAQ;aAMlB,UAAU,CAAC,EAAE,MAAM;IALrC,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;gBAG9B,OAAO,EAAE,MAAM,EACC,UAAU,CAAC,EAAE,MAAM,YAAA,EACnC,KAAK,CAAC,EAAE,MAAM,EAAE,EAChB,KAAK,CAAC,EAAE,OAAO;IAMR,MAAM;;;IAIf,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ;CAUhD;AA2BD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D"}
@@ -0,0 +1,8 @@
1
+ export { createContext, createTestContext } from "./context.ts";
2
+ export type { CommandContext, CommandOptions } from "./context.ts";
3
+ export { OutputFormatter } from "./output.ts";
4
+ export type { OutputFormat } from "./types.ts";
5
+ export { CliError, ConfigError, ValidationError, ApiError, isCliError } from "./errors.ts";
6
+ export { handleError, runCommand, ExitCode } from "./error-handler.ts";
7
+ export { getConfig } from "./config.ts";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import { _ as ConfigError, a as createContext, f as getConfig, g as CliError, h as ApiError, i as runCommand, o as createTestContext, r as handleError, s as OutputFormatter, t as ExitCode, v as ValidationError, y as isCliError } from "./error-handler-BahHMt6t.js";
2
+ export { ApiError, CliError, ConfigError, ExitCode, OutputFormatter, ValidationError, createContext, createTestContext, getConfig, handleError, isCliError, runCommand };
@@ -0,0 +1,47 @@
1
+ import type { OutputFormat } from "./types.ts";
2
+ /**
3
+ * Output formatter for CLI commands.
4
+ * Supports human-readable, JSON, and table formats.
5
+ */
6
+ export declare class OutputFormatter {
7
+ private format;
8
+ private noColor;
9
+ constructor(format?: OutputFormat, noColor?: boolean);
10
+ /**
11
+ * Returns true when the current format is JSON.
12
+ */
13
+ isJson(): boolean;
14
+ /**
15
+ * Output data in the configured format.
16
+ * Use format='json' for AI agents and structured data.
17
+ */
18
+ output(data: unknown): void;
19
+ /**
20
+ * Output a list with a human-readable one-liner per item and a table for table format.
21
+ * Falls back to JSON for json format.
22
+ *
23
+ * @param data - Array of items to display
24
+ * @param columns - Ordered list of field names to include in human/table output
25
+ * @param emptyMessage - Message shown when data is empty (human format only)
26
+ * @param lineFormat - Optional custom line formatter for human format
27
+ */
28
+ outputList<T extends object>(data: T[], columns: (keyof T & string)[], emptyMessage: string, lineFormat?: (item: T) => string): void;
29
+ /**
30
+ * Output a single resource in human-readable format.
31
+ * For json format, uses JSON.stringify. For table format, uses a two-column key/value table.
32
+ *
33
+ * @param data - Object to display
34
+ * @param fields - Ordered list of fields to display (defaults to all keys)
35
+ */
36
+ outputOne<T extends object>(data: T, fields?: (keyof T & string)[]): void;
37
+ success(message: string): void;
38
+ error(message: string, details?: unknown): void;
39
+ warning(message: string): void;
40
+ info(message: string): void;
41
+ private outputTable;
42
+ }
43
+ export declare const x: {
44
+ a: number;
45
+ b: number;
46
+ };
47
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C;;;GAGG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;gBADP,MAAM,GAAE,YAAsB,EAC9B,OAAO,GAAE,OAAe;IAGlC;;OAEG;IACH,MAAM,IAAI,OAAO;IAIjB;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAe3B;;;;;;;;OAQG;IACH,UAAU,CAAC,CAAC,SAAS,MAAM,EACzB,IAAI,EAAE,CAAC,EAAE,EACT,OAAO,EAAE,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,EAC7B,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAC/B,IAAI;IAsCP;;;;;;OAMG;IACH,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GAAG,IAAI;IAyBzE,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQ9B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI;IAW/C,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQ9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQ3B,OAAO,CAAC,WAAW;CAwBpB;AACD,eAAO,MAAM,CAAC;;;CAAiB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type OutputFormat = "json" | "human" | "table";
2
+ export interface CliOptions {
3
+ format?: OutputFormat;
4
+ quiet?: boolean;
5
+ noColor?: boolean;
6
+ }
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Simple argument parser using native Node.js.
3
+ * Parses process.argv into a structured format with no external deps.
4
+ */
5
+ export type OptionValue = string | boolean | string[];
6
+ export interface ParsedArgs {
7
+ command: string[];
8
+ options: Record<string, OptionValue>;
9
+ positional: string[];
10
+ }
11
+ export declare function parseArgs(argv?: string[]): ParsedArgs;
12
+ export declare function getOption(options: Record<string, OptionValue>, names: string[], defaultValue?: string): string | undefined;
13
+ export declare function hasFlag(options: Record<string, OptionValue>, names: string[]): boolean;
14
+ //# sourceMappingURL=args.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/utils/args.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACrC,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,wBAAgB,SAAS,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,UAAU,CAwD5E;AAED,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACpC,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAQpB;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAEtF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ANSI color utilities using native Node.js.
3
+ * Provides terminal colors without external dependencies.
4
+ */
5
+ export declare function setColorEnabled(enabled: boolean): void;
6
+ export declare function isColorEnabled(): boolean;
7
+ export declare const colors: {
8
+ reset: (text: string) => string;
9
+ bold: (text: string) => string;
10
+ dim: (text: string) => string;
11
+ red: (text: string) => string;
12
+ green: (text: string) => string;
13
+ yellow: (text: string) => string;
14
+ cyan: (text: string) => string;
15
+ gray: (text: string) => string;
16
+ };
17
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAEtD;AAED,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAOD,eAAO,MAAM,MAAM;kBACH,MAAM;iBACP,MAAM;gBACP,MAAM;gBACN,MAAM;kBACJ,MAAM;mBACL,MAAM;iBACR,MAAM;iBACN,MAAM;CACpB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Generic command router factory for CLI commands.
3
+ *
4
+ * Eliminates boilerplate switch/case pattern in command routing.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { createCommandRouter } from '../../utils/command-router.ts';
9
+ * import { serversList, serversGet } from './handlers.ts';
10
+ *
11
+ * export const handleServersCommand = createCommandRouter({
12
+ * resource: 'servers',
13
+ * handlers: {
14
+ * list: serversList,
15
+ * ls: serversList,
16
+ * get: [serversGet, 'args'],
17
+ * },
18
+ * });
19
+ * ```
20
+ */
21
+ import type { CommandContext } from "../context.ts";
22
+ /**
23
+ * Handler that only receives context (e.g., list commands)
24
+ */
25
+ export type ListHandler = (ctx: CommandContext) => Promise<void>;
26
+ /**
27
+ * Handler that receives args and context (e.g., get/update commands)
28
+ */
29
+ export type ArgsHandler = (args: string[], ctx: CommandContext) => Promise<void>;
30
+ /**
31
+ * Handler definition - either a ListHandler or an ArgsHandler marked with 'args'
32
+ */
33
+ export type Handler = ListHandler | [ArgsHandler, "args"];
34
+ /**
35
+ * Configuration for the command router
36
+ */
37
+ export interface CommandRouterConfig {
38
+ /** Resource name for error messages (e.g., 'servers', 'sites') */
39
+ resource: string;
40
+ /** Map of subcommand names to handlers */
41
+ handlers: Record<string, Handler>;
42
+ }
43
+ /**
44
+ * Creates a command router function that dispatches to the appropriate handler.
45
+ */
46
+ export declare function createCommandRouter(config: CommandRouterConfig): (subcommand: string, args: string[], options: Record<string, string | boolean | string[]>) => Promise<void>;
47
+ //# sourceMappingURL=command-router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-router.d.ts","sourceRoot":"","sources":["../../src/utils/command-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,eAAe,CAAC;AAMpE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEjF;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,IAE3D,YAAY,MAAM,EAClB,MAAM,MAAM,EAAE,EACd,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC,KACnD,OAAO,CAAC,IAAI,CAAC,CAqBjB"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Smart resolution utilities for --server and --site options.
3
+ *
4
+ * Accepts numeric IDs (used as-is) or plain strings (resolved by name/partial match).
5
+ */
6
+ import type { ExecutorContext } from "@studiometa/forge-core";
7
+ /**
8
+ * Resolve a --server value to a numeric server ID string.
9
+ *
10
+ * - Numeric string → returned as-is (no API call)
11
+ * - Plain string → fetch all servers, exact match first, then partial match
12
+ * - 0 matches → ValidationError listing available servers
13
+ * - 2+ matches → ValidationError listing ambiguous matches
14
+ */
15
+ export declare function resolveServerId(value: string, execCtx: ExecutorContext): Promise<string>;
16
+ /**
17
+ * Resolve a --site value to a numeric site ID string.
18
+ *
19
+ * - Numeric string → returned as-is (no API call)
20
+ * - Plain string → fetch all sites for the server, exact domain match first, then partial
21
+ * - 0 matches → ValidationError listing available sites
22
+ * - 2+ matches → ValidationError listing ambiguous matches
23
+ */
24
+ export declare function resolveSiteId(value: string, serverId: string, execCtx: ExecutorContext): Promise<string>;
25
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/utils/resolve.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI9D;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAoC9F;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CAoCjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiometa/forge-cli",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "CLI tool for managing Laravel Forge servers, sites, and deployments",
5
5
  "keywords": [
6
6
  "ai-agent",
@@ -18,7 +18,47 @@
18
18
  "url": "https://github.com/studiometa/forge-tools",
19
19
  "directory": "packages/cli"
20
20
  },
21
+ "bin": {
22
+ "forge-cli": "./dist/cli.js"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "type": "module",
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ }
35
+ },
21
36
  "publishConfig": {
22
37
  "access": "public"
38
+ },
39
+ "scripts": {
40
+ "dev": "vite build --watch",
41
+ "build": "vite build && tsc --emitDeclarationOnly",
42
+ "test": "vitest run",
43
+ "test:watch": "vitest",
44
+ "test:ci": "vitest run --coverage",
45
+ "lint": "oxlint src",
46
+ "format": "oxfmt --write src",
47
+ "format:check": "oxfmt --check src",
48
+ "typecheck": "tsc --noEmit"
49
+ },
50
+ "dependencies": {
51
+ "@studiometa/forge-api": "*",
52
+ "@studiometa/forge-core": "*"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^24.0.0",
56
+ "@vitest/coverage-v8": "^4.1.0-beta.4",
57
+ "typescript": "^5.7.3",
58
+ "vite": "^8.0.0-beta.14",
59
+ "vitest": "^4.1.0-beta.4"
60
+ },
61
+ "engines": {
62
+ "node": ">=24.0.0"
23
63
  }
24
64
  }