@studiometa/forge-cli 0.0.1 → 0.2.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 (197) hide show
  1. package/README.md +252 -0
  2. package/dist/audit.d.ts +3 -0
  3. package/dist/audit.d.ts.map +1 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +3567 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/backups/command.d.ts +2 -0
  9. package/dist/commands/backups/command.d.ts.map +1 -0
  10. package/dist/commands/backups/handlers.d.ts +6 -0
  11. package/dist/commands/backups/handlers.d.ts.map +1 -0
  12. package/dist/commands/backups/help.d.ts +2 -0
  13. package/dist/commands/backups/help.d.ts.map +1 -0
  14. package/dist/commands/backups/index.d.ts +3 -0
  15. package/dist/commands/backups/index.d.ts.map +1 -0
  16. package/dist/commands/certificates/command.d.ts +2 -0
  17. package/dist/commands/certificates/command.d.ts.map +1 -0
  18. package/dist/commands/certificates/handlers.d.ts +5 -0
  19. package/dist/commands/certificates/handlers.d.ts.map +1 -0
  20. package/dist/commands/certificates/help.d.ts +2 -0
  21. package/dist/commands/certificates/help.d.ts.map +1 -0
  22. package/dist/commands/certificates/index.d.ts +3 -0
  23. package/dist/commands/certificates/index.d.ts.map +1 -0
  24. package/dist/commands/commands/command.d.ts +2 -0
  25. package/dist/commands/commands/command.d.ts.map +1 -0
  26. package/dist/commands/commands/handlers.d.ts +5 -0
  27. package/dist/commands/commands/handlers.d.ts.map +1 -0
  28. package/dist/commands/commands/help.d.ts +2 -0
  29. package/dist/commands/commands/help.d.ts.map +1 -0
  30. package/dist/commands/commands/index.d.ts +3 -0
  31. package/dist/commands/commands/index.d.ts.map +1 -0
  32. package/dist/commands/completion.d.ts +6 -0
  33. package/dist/commands/completion.d.ts.map +1 -0
  34. package/dist/commands/config.d.ts +6 -0
  35. package/dist/commands/config.d.ts.map +1 -0
  36. package/dist/commands/daemons/command.d.ts +2 -0
  37. package/dist/commands/daemons/command.d.ts.map +1 -0
  38. package/dist/commands/daemons/handlers.d.ts +5 -0
  39. package/dist/commands/daemons/handlers.d.ts.map +1 -0
  40. package/dist/commands/daemons/help.d.ts +2 -0
  41. package/dist/commands/daemons/help.d.ts.map +1 -0
  42. package/dist/commands/daemons/index.d.ts +3 -0
  43. package/dist/commands/daemons/index.d.ts.map +1 -0
  44. package/dist/commands/database-users/command.d.ts +2 -0
  45. package/dist/commands/database-users/command.d.ts.map +1 -0
  46. package/dist/commands/database-users/handlers.d.ts +6 -0
  47. package/dist/commands/database-users/handlers.d.ts.map +1 -0
  48. package/dist/commands/database-users/help.d.ts +2 -0
  49. package/dist/commands/database-users/help.d.ts.map +1 -0
  50. package/dist/commands/database-users/index.d.ts +3 -0
  51. package/dist/commands/database-users/index.d.ts.map +1 -0
  52. package/dist/commands/databases/command.d.ts +2 -0
  53. package/dist/commands/databases/command.d.ts.map +1 -0
  54. package/dist/commands/databases/handlers.d.ts +4 -0
  55. package/dist/commands/databases/handlers.d.ts.map +1 -0
  56. package/dist/commands/databases/help.d.ts +2 -0
  57. package/dist/commands/databases/help.d.ts.map +1 -0
  58. package/dist/commands/databases/index.d.ts +3 -0
  59. package/dist/commands/databases/index.d.ts.map +1 -0
  60. package/dist/commands/deployments/command.d.ts +2 -0
  61. package/dist/commands/deployments/command.d.ts.map +1 -0
  62. package/dist/commands/deployments/handlers.d.ts +4 -0
  63. package/dist/commands/deployments/handlers.d.ts.map +1 -0
  64. package/dist/commands/deployments/help.d.ts +2 -0
  65. package/dist/commands/deployments/help.d.ts.map +1 -0
  66. package/dist/commands/deployments/index.d.ts +3 -0
  67. package/dist/commands/deployments/index.d.ts.map +1 -0
  68. package/dist/commands/env/command.d.ts +2 -0
  69. package/dist/commands/env/command.d.ts.map +1 -0
  70. package/dist/commands/env/handlers.d.ts +4 -0
  71. package/dist/commands/env/handlers.d.ts.map +1 -0
  72. package/dist/commands/env/help.d.ts +2 -0
  73. package/dist/commands/env/help.d.ts.map +1 -0
  74. package/dist/commands/env/index.d.ts +3 -0
  75. package/dist/commands/env/index.d.ts.map +1 -0
  76. package/dist/commands/firewall-rules/command.d.ts +2 -0
  77. package/dist/commands/firewall-rules/command.d.ts.map +1 -0
  78. package/dist/commands/firewall-rules/handlers.d.ts +4 -0
  79. package/dist/commands/firewall-rules/handlers.d.ts.map +1 -0
  80. package/dist/commands/firewall-rules/help.d.ts +2 -0
  81. package/dist/commands/firewall-rules/help.d.ts.map +1 -0
  82. package/dist/commands/firewall-rules/index.d.ts +3 -0
  83. package/dist/commands/firewall-rules/index.d.ts.map +1 -0
  84. package/dist/commands/monitors/command.d.ts +2 -0
  85. package/dist/commands/monitors/command.d.ts.map +1 -0
  86. package/dist/commands/monitors/handlers.d.ts +6 -0
  87. package/dist/commands/monitors/handlers.d.ts.map +1 -0
  88. package/dist/commands/monitors/help.d.ts +2 -0
  89. package/dist/commands/monitors/help.d.ts.map +1 -0
  90. package/dist/commands/monitors/index.d.ts +3 -0
  91. package/dist/commands/monitors/index.d.ts.map +1 -0
  92. package/dist/commands/nginx/command.d.ts +2 -0
  93. package/dist/commands/nginx/command.d.ts.map +1 -0
  94. package/dist/commands/nginx/handlers.d.ts +4 -0
  95. package/dist/commands/nginx/handlers.d.ts.map +1 -0
  96. package/dist/commands/nginx/help.d.ts +2 -0
  97. package/dist/commands/nginx/help.d.ts.map +1 -0
  98. package/dist/commands/nginx/index.d.ts +3 -0
  99. package/dist/commands/nginx/index.d.ts.map +1 -0
  100. package/dist/commands/nginx-templates/command.d.ts +2 -0
  101. package/dist/commands/nginx-templates/command.d.ts.map +1 -0
  102. package/dist/commands/nginx-templates/handlers.d.ts +7 -0
  103. package/dist/commands/nginx-templates/handlers.d.ts.map +1 -0
  104. package/dist/commands/nginx-templates/help.d.ts +2 -0
  105. package/dist/commands/nginx-templates/help.d.ts.map +1 -0
  106. package/dist/commands/nginx-templates/index.d.ts +3 -0
  107. package/dist/commands/nginx-templates/index.d.ts.map +1 -0
  108. package/dist/commands/recipes/command.d.ts +2 -0
  109. package/dist/commands/recipes/command.d.ts.map +1 -0
  110. package/dist/commands/recipes/handlers.d.ts +5 -0
  111. package/dist/commands/recipes/handlers.d.ts.map +1 -0
  112. package/dist/commands/recipes/help.d.ts +2 -0
  113. package/dist/commands/recipes/help.d.ts.map +1 -0
  114. package/dist/commands/recipes/index.d.ts +3 -0
  115. package/dist/commands/recipes/index.d.ts.map +1 -0
  116. package/dist/commands/redirect-rules/command.d.ts +2 -0
  117. package/dist/commands/redirect-rules/command.d.ts.map +1 -0
  118. package/dist/commands/redirect-rules/handlers.d.ts +6 -0
  119. package/dist/commands/redirect-rules/handlers.d.ts.map +1 -0
  120. package/dist/commands/redirect-rules/help.d.ts +2 -0
  121. package/dist/commands/redirect-rules/help.d.ts.map +1 -0
  122. package/dist/commands/redirect-rules/index.d.ts +3 -0
  123. package/dist/commands/redirect-rules/index.d.ts.map +1 -0
  124. package/dist/commands/scheduled-jobs/command.d.ts +2 -0
  125. package/dist/commands/scheduled-jobs/command.d.ts.map +1 -0
  126. package/dist/commands/scheduled-jobs/handlers.d.ts +6 -0
  127. package/dist/commands/scheduled-jobs/handlers.d.ts.map +1 -0
  128. package/dist/commands/scheduled-jobs/help.d.ts +2 -0
  129. package/dist/commands/scheduled-jobs/help.d.ts.map +1 -0
  130. package/dist/commands/scheduled-jobs/index.d.ts +3 -0
  131. package/dist/commands/scheduled-jobs/index.d.ts.map +1 -0
  132. package/dist/commands/security-rules/command.d.ts +2 -0
  133. package/dist/commands/security-rules/command.d.ts.map +1 -0
  134. package/dist/commands/security-rules/handlers.d.ts +6 -0
  135. package/dist/commands/security-rules/handlers.d.ts.map +1 -0
  136. package/dist/commands/security-rules/help.d.ts +2 -0
  137. package/dist/commands/security-rules/help.d.ts.map +1 -0
  138. package/dist/commands/security-rules/index.d.ts +3 -0
  139. package/dist/commands/security-rules/index.d.ts.map +1 -0
  140. package/dist/commands/servers/command.d.ts +2 -0
  141. package/dist/commands/servers/command.d.ts.map +1 -0
  142. package/dist/commands/servers/handlers.d.ts +18 -0
  143. package/dist/commands/servers/handlers.d.ts.map +1 -0
  144. package/dist/commands/servers/help.d.ts +2 -0
  145. package/dist/commands/servers/help.d.ts.map +1 -0
  146. package/dist/commands/servers/index.d.ts +3 -0
  147. package/dist/commands/servers/index.d.ts.map +1 -0
  148. package/dist/commands/sites/command.d.ts +2 -0
  149. package/dist/commands/sites/command.d.ts.map +1 -0
  150. package/dist/commands/sites/handlers.d.ts +4 -0
  151. package/dist/commands/sites/handlers.d.ts.map +1 -0
  152. package/dist/commands/sites/help.d.ts +2 -0
  153. package/dist/commands/sites/help.d.ts.map +1 -0
  154. package/dist/commands/sites/index.d.ts +3 -0
  155. package/dist/commands/sites/index.d.ts.map +1 -0
  156. package/dist/commands/ssh-keys/command.d.ts +2 -0
  157. package/dist/commands/ssh-keys/command.d.ts.map +1 -0
  158. package/dist/commands/ssh-keys/handlers.d.ts +4 -0
  159. package/dist/commands/ssh-keys/handlers.d.ts.map +1 -0
  160. package/dist/commands/ssh-keys/help.d.ts +2 -0
  161. package/dist/commands/ssh-keys/help.d.ts.map +1 -0
  162. package/dist/commands/ssh-keys/index.d.ts +3 -0
  163. package/dist/commands/ssh-keys/index.d.ts.map +1 -0
  164. package/dist/commands/user/command.d.ts +2 -0
  165. package/dist/commands/user/command.d.ts.map +1 -0
  166. package/dist/commands/user/handlers.d.ts +3 -0
  167. package/dist/commands/user/handlers.d.ts.map +1 -0
  168. package/dist/commands/user/help.d.ts +2 -0
  169. package/dist/commands/user/help.d.ts.map +1 -0
  170. package/dist/commands/user/index.d.ts +3 -0
  171. package/dist/commands/user/index.d.ts.map +1 -0
  172. package/dist/config.d.ts +18 -0
  173. package/dist/config.d.ts.map +1 -0
  174. package/dist/context.d.ts +50 -0
  175. package/dist/context.d.ts.map +1 -0
  176. package/dist/error-handler-BahHMt6t.js +396 -0
  177. package/dist/error-handler-BahHMt6t.js.map +1 -0
  178. package/dist/error-handler.d.ts +39 -0
  179. package/dist/error-handler.d.ts.map +1 -0
  180. package/dist/errors.d.ts +45 -0
  181. package/dist/errors.d.ts.map +1 -0
  182. package/dist/index.d.ts +8 -0
  183. package/dist/index.d.ts.map +1 -0
  184. package/dist/index.js +2 -0
  185. package/dist/output.d.ts +47 -0
  186. package/dist/output.d.ts.map +1 -0
  187. package/dist/types.d.ts +7 -0
  188. package/dist/types.d.ts.map +1 -0
  189. package/dist/utils/args.d.ts +14 -0
  190. package/dist/utils/args.d.ts.map +1 -0
  191. package/dist/utils/colors.d.ts +17 -0
  192. package/dist/utils/colors.d.ts.map +1 -0
  193. package/dist/utils/command-router.d.ts +52 -0
  194. package/dist/utils/command-router.d.ts.map +1 -0
  195. package/dist/utils/resolve.d.ts +25 -0
  196. package/dist/utils/resolve.d.ts.map +1 -0
  197. package/package.json +41 -1
@@ -0,0 +1,6 @@
1
+ import type { CommandContext } from "../../context.ts";
2
+ export declare function securityRulesList(ctx: CommandContext): Promise<void>;
3
+ export declare function securityRulesGet(args: string[], ctx: CommandContext): Promise<void>;
4
+ export declare function securityRulesCreate(ctx: CommandContext): Promise<void>;
5
+ export declare function securityRulesDelete(args: string[], ctx: CommandContext): Promise<void>;
6
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/commands/security-rules/handlers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAsBvD,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB1E;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBzF;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB5E;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB5F"}
@@ -0,0 +1,2 @@
1
+ export declare function showSecurityRulesHelp(subcommand?: string): void;
2
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/security-rules/help.ts"],"names":[],"mappings":"AAEA,wBAAgB,qBAAqB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CA6D/D"}
@@ -0,0 +1,3 @@
1
+ export { handleSecurityRulesCommand } from "./command.ts";
2
+ export { showSecurityRulesHelp } from "./help.ts";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/security-rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const handleServersCommand: (subcommand: string, args: string[], options: Record<string, string | boolean | string[]>) => Promise<void>;
2
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/command.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,6GAS/B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * CLI handlers for servers commands.
3
+ * Delegates all HTTP logic to forge-core executors.
4
+ */
5
+ import type { CommandContext } from "../../context.ts";
6
+ /**
7
+ * List all servers.
8
+ */
9
+ export declare function serversList(ctx: CommandContext): Promise<void>;
10
+ /**
11
+ * Get a single server by ID or name.
12
+ */
13
+ export declare function serversGet(args: string[], ctx: CommandContext): Promise<void>;
14
+ /**
15
+ * Reboot a server by ID or name.
16
+ */
17
+ export declare function serversReboot(args: string[], ctx: CommandContext): Promise<void>;
18
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD;;GAEG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBpE;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAcnF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CActF"}
@@ -0,0 +1,2 @@
1
+ export declare function showServersHelp(subcommand?: string): void;
2
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/help.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CA0EzD"}
@@ -0,0 +1,3 @@
1
+ export { handleServersCommand } from "./command.ts";
2
+ export { showServersHelp } from "./help.ts";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/servers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const handleSitesCommand: (subcommand: string, args: string[], options: Record<string, string | boolean | string[]>) => Promise<void>;
2
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/command.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,6GAO7B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { CommandContext } from "../../context.ts";
2
+ export declare function sitesList(ctx: CommandContext): Promise<void>;
3
+ export declare function sitesGet(args: string[], ctx: CommandContext): Promise<void>;
4
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBlE;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAuCjF"}
@@ -0,0 +1,2 @@
1
+ export declare function showSitesHelp(subcommand?: string): void;
2
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/help.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAqDvD"}
@@ -0,0 +1,3 @@
1
+ export { handleSitesCommand } from "./command.ts";
2
+ export { showSitesHelp } from "./help.ts";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sites/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const handleSshKeysCommand: (subcommand: string, args: string[], options: Record<string, string | boolean | string[]>) => Promise<void>;
2
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/ssh-keys/command.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB,6GAO/B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { CommandContext } from "../../context.ts";
2
+ export declare function sshKeysList(ctx: CommandContext): Promise<void>;
3
+ export declare function sshKeysGet(args: string[], ctx: CommandContext): Promise<void>;
4
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/commands/ssh-keys/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBpE;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BnF"}
@@ -0,0 +1,2 @@
1
+ export declare function showSshKeysHelp(subcommand?: string): void;
2
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/ssh-keys/help.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAiCzD"}
@@ -0,0 +1,3 @@
1
+ export { handleSshKeysCommand } from "./command.ts";
2
+ export { showSshKeysHelp } from "./help.ts";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/ssh-keys/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const handleUserCommand: (subcommand: string, args: string[], options: Record<string, string | boolean | string[]>) => Promise<void>;
2
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/user/command.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,6GAK5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CommandContext } from "../../context.ts";
2
+ export declare function userGet(ctx: CommandContext): Promise<void>;
3
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/commands/user/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD,wBAAsB,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhE"}
@@ -0,0 +1,2 @@
1
+ export declare function showUserHelp(subcommand?: string): void;
2
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../src/commands/user/help.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CA2BtD"}
@@ -0,0 +1,3 @@
1
+ export { handleUserCommand } from "./command.ts";
2
+ export { showUserHelp } from "./help.ts";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/user/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Config loading for forge-cli.
3
+ *
4
+ * Resolution priority (highest to lowest):
5
+ * 1. CLI arguments (--token)
6
+ * 2. Environment variable (FORGE_API_TOKEN)
7
+ * 3. Config file (XDG-compliant)
8
+ */
9
+ export interface ForgeCliConfig {
10
+ /** Forge API token */
11
+ apiToken: string | undefined;
12
+ }
13
+ /**
14
+ * Resolve config from multiple sources with priority order.
15
+ */
16
+ export declare function getConfig(cliOptions?: Record<string, string | boolean | string[]>): ForgeCliConfig;
17
+ export { createConfigStore, getToken, setToken, deleteToken } from "@studiometa/forge-api";
18
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,cAAc;IAC7B,sBAAsB;IACtB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAgB,SAAS,CACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC,GACvD,cAAc,CAUhB;AAED,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * CLI execution context with dependency injection.
3
+ *
4
+ * Instead of hidden dependencies in command handlers, this module provides
5
+ * explicit dependency passing for testability and transparency.
6
+ */
7
+ import type { HttpClient } from "@studiometa/forge-api";
8
+ import type { ExecutorContext } from "@studiometa/forge-core";
9
+ import { OutputFormatter } from "./output.ts";
10
+ export interface CommandOptions {
11
+ [key: string]: string | boolean | string[] | undefined;
12
+ format?: string;
13
+ f?: string;
14
+ token?: string;
15
+ "no-color"?: boolean;
16
+ }
17
+ /**
18
+ * Context containing all dependencies needed by command handlers.
19
+ */
20
+ export interface CommandContext {
21
+ /** Output formatter for the current format */
22
+ readonly formatter: OutputFormatter;
23
+ /** Raw CLI options */
24
+ readonly options: CommandOptions;
25
+ /** Create an ExecutorContext from this command context */
26
+ createExecutorContext(token: string): ExecutorContext;
27
+ /** Resolve the API token or throw ConfigError */
28
+ getToken(): string;
29
+ }
30
+ /**
31
+ * Creates a command context from CLI options.
32
+ */
33
+ export declare function createContext(options?: CommandOptions): CommandContext;
34
+ /**
35
+ * Creates a test context for unit tests.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const ctx = createTestContext({
40
+ * mockClient: { get: async () => ({ servers: [] }) } as never,
41
+ * });
42
+ * ```
43
+ */
44
+ export declare function createTestContext(overrides: {
45
+ options?: CommandOptions;
46
+ formatter?: OutputFormatter;
47
+ token?: string;
48
+ mockClient?: HttpClient;
49
+ }): CommandContext;
50
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAO9D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,sBAAsB;IACtB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,0DAA0D;IAC1D,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAAC;IACtD,iDAAiD;IACjD,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,cAAmB,GAAG,cAAc,CA4B1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE;IAC3C,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,GAAG,cAAc,CAyBjB"}
@@ -0,0 +1,396 @@
1
+ import { HttpClient, createConfigStore, createConfigStore as createConfigStore$1, deleteToken, getToken, getToken as getToken$1, setToken } from "@studiometa/forge-api";
2
+ /**
3
+ * Error types for forge-cli.
4
+ *
5
+ * Provides specific error types for different failure scenarios with
6
+ * recovery hints for both humans and AI agents.
7
+ */
8
+ /**
9
+ * Base error class for all CLI errors.
10
+ */
11
+ var CliError = class extends Error {
12
+ constructor(message, hints, cause) {
13
+ super(message);
14
+ this.hints = hints;
15
+ this.cause = cause;
16
+ this.name = this.constructor.name;
17
+ Error.captureStackTrace?.(this, this.constructor);
18
+ }
19
+ toJSON() {
20
+ return {
21
+ error: this.code,
22
+ name: this.name,
23
+ message: this.message,
24
+ isRecoverable: this.isRecoverable,
25
+ ...this.hints && this.hints.length > 0 ? { hints: this.hints } : {},
26
+ ...this.cause instanceof Error ? { cause: { message: this.cause.message } } : {}
27
+ };
28
+ }
29
+ toFormattedMessage() {
30
+ let msg = this.message;
31
+ if (this.hints && this.hints.length > 0) msg += "\n\nHints:\n" + this.hints.map((h) => ` • ${h}`).join("\n");
32
+ return msg;
33
+ }
34
+ };
35
+ var ConfigError = class ConfigError extends CliError {
36
+ code = "CONFIG_ERROR";
37
+ isRecoverable = true;
38
+ static missingToken() {
39
+ return new ConfigError("API token not configured", [
40
+ "Set via CLI flag: --token <token>",
41
+ "Set via environment: export FORGE_API_TOKEN=<token>",
42
+ "Set via config: forge-cli config set YOUR_TOKEN"
43
+ ]);
44
+ }
45
+ };
46
+ var ValidationError = class ValidationError extends CliError {
47
+ code = "VALIDATION_ERROR";
48
+ isRecoverable = true;
49
+ constructor(message, field, hints, cause) {
50
+ super(message, hints, cause);
51
+ this.field = field;
52
+ }
53
+ toJSON() {
54
+ return {
55
+ ...super.toJSON(),
56
+ field: this.field
57
+ };
58
+ }
59
+ static required(field, hints) {
60
+ return new ValidationError(`${field} is required`, field, hints);
61
+ }
62
+ };
63
+ var ApiError = class ApiError extends CliError {
64
+ code = "API_ERROR";
65
+ isRecoverable;
66
+ constructor(message, statusCode, hints, cause) {
67
+ super(message, hints ?? getApiErrorHints(statusCode), cause);
68
+ this.statusCode = statusCode;
69
+ this.isRecoverable = statusCode === void 0 || statusCode >= 500 && statusCode < 600;
70
+ }
71
+ toJSON() {
72
+ return {
73
+ ...super.toJSON(),
74
+ statusCode: this.statusCode
75
+ };
76
+ }
77
+ static fromForgeError(error) {
78
+ if (error instanceof Error && "statusCode" in error) {
79
+ const e = error;
80
+ return new ApiError(e.message, e.statusCode, void 0, e);
81
+ }
82
+ if (error instanceof Error) return new ApiError(error.message, void 0, void 0, error);
83
+ return new ApiError(String(error));
84
+ }
85
+ };
86
+ function getApiErrorHints(statusCode) {
87
+ if (statusCode === 401) return ["Check that your API token is valid", "Set via: export FORGE_API_TOKEN=<token>"];
88
+ if (statusCode === 403) return ["You may not have permission to access this resource"];
89
+ if (statusCode === 404) return [
90
+ "The resource may not exist",
91
+ "Verify the ID is correct",
92
+ "Use the list command to find valid IDs"
93
+ ];
94
+ if (statusCode === 429) return ["Too many requests — wait before retrying"];
95
+ if (statusCode !== void 0 && statusCode >= 500) return ["Server error — try again later"];
96
+ return [];
97
+ }
98
+ function isCliError(error) {
99
+ return error instanceof CliError;
100
+ }
101
+ /**
102
+ * Config loading for forge-cli.
103
+ *
104
+ * Resolution priority (highest to lowest):
105
+ * 1. CLI arguments (--token)
106
+ * 2. Environment variable (FORGE_API_TOKEN)
107
+ * 3. Config file (XDG-compliant)
108
+ */
109
+ /**
110
+ * Resolve config from multiple sources with priority order.
111
+ */
112
+ function getConfig(cliOptions) {
113
+ const cliToken = cliOptions?.token;
114
+ const storedToken = getToken(createConfigStore());
115
+ return { apiToken: typeof cliToken === "string" ? cliToken : storedToken ?? void 0 };
116
+ }
117
+ /**
118
+ * ANSI color utilities using native Node.js.
119
+ * Provides terminal colors without external dependencies.
120
+ */
121
+ var RESET = "\x1B[0m";
122
+ var BOLD = "\x1B[1m";
123
+ var DIM = "\x1B[2m";
124
+ var FG_RED = "\x1B[31m";
125
+ var FG_GREEN = "\x1B[32m";
126
+ var FG_YELLOW = "\x1B[33m";
127
+ var FG_CYAN = "\x1B[36m";
128
+ var FG_GRAY = "\x1B[90m";
129
+ var colorEnabled = process.env.NO_COLOR === void 0;
130
+ function setColorEnabled(enabled) {
131
+ colorEnabled = enabled;
132
+ }
133
+ function colorize(text, code) {
134
+ if (!colorEnabled) return text;
135
+ return `${code}${text}${RESET}`;
136
+ }
137
+ const colors = {
138
+ reset: (text) => colorEnabled ? `${RESET}${text}` : text,
139
+ bold: (text) => colorize(text, BOLD),
140
+ dim: (text) => colorize(text, DIM),
141
+ red: (text) => colorize(text, FG_RED),
142
+ green: (text) => colorize(text, FG_GREEN),
143
+ yellow: (text) => colorize(text, FG_YELLOW),
144
+ cyan: (text) => colorize(text, FG_CYAN),
145
+ gray: (text) => colorize(text, FG_GRAY)
146
+ };
147
+ /**
148
+ * Output formatter for CLI commands.
149
+ * Supports human-readable, JSON, and table formats.
150
+ */
151
+ var OutputFormatter = class {
152
+ constructor(format = "human", noColor = false) {
153
+ this.format = format;
154
+ this.noColor = noColor;
155
+ }
156
+ /**
157
+ * Returns true when the current format is JSON.
158
+ */
159
+ isJson() {
160
+ return this.format === "json";
161
+ }
162
+ /**
163
+ * Output data in the configured format.
164
+ * Use format='json' for AI agents and structured data.
165
+ */
166
+ output(data) {
167
+ switch (this.format) {
168
+ case "json":
169
+ console.log(JSON.stringify(data, null, 2));
170
+ break;
171
+ case "table":
172
+ this.outputTable(data);
173
+ break;
174
+ default:
175
+ console.log(data);
176
+ break;
177
+ }
178
+ }
179
+ /**
180
+ * Output a list with a human-readable one-liner per item and a table for table format.
181
+ * Falls back to JSON for json format.
182
+ *
183
+ * @param data - Array of items to display
184
+ * @param columns - Ordered list of field names to include in human/table output
185
+ * @param emptyMessage - Message shown when data is empty (human format only)
186
+ * @param lineFormat - Optional custom line formatter for human format
187
+ */
188
+ outputList(data, columns, emptyMessage, lineFormat) {
189
+ if (this.format === "json") {
190
+ console.log(JSON.stringify(data, null, 2));
191
+ return;
192
+ }
193
+ if (this.format === "table") {
194
+ this.outputTable(data.map((item) => Object.fromEntries(columns.map((c) => [c, item[c]]))));
195
+ return;
196
+ }
197
+ if (data.length === 0) {
198
+ console.log(colors.cyan(emptyMessage));
199
+ return;
200
+ }
201
+ if (lineFormat) {
202
+ for (const item of data) console.log(lineFormat(item));
203
+ return;
204
+ }
205
+ const widths = columns.map((col) => Math.max(col.length, ...data.map((item) => String(item[col] ?? "").length)));
206
+ for (const item of data) {
207
+ const row = item;
208
+ const line = columns.map((col, i) => String(row[col] ?? "").padEnd(widths[i])).join(" ");
209
+ console.log(line.trimEnd());
210
+ }
211
+ }
212
+ /**
213
+ * Output a single resource in human-readable format.
214
+ * For json format, uses JSON.stringify. For table format, uses a two-column key/value table.
215
+ *
216
+ * @param data - Object to display
217
+ * @param fields - Ordered list of fields to display (defaults to all keys)
218
+ */
219
+ outputOne(data, fields) {
220
+ if (this.format === "json") {
221
+ console.log(JSON.stringify(data, null, 2));
222
+ return;
223
+ }
224
+ const record = data;
225
+ const keys = fields ?? Object.keys(record);
226
+ if (this.format === "table") {
227
+ const rows = keys.map((k) => ({
228
+ field: k,
229
+ value: String(record[k] ?? "")
230
+ }));
231
+ this.outputTable(rows);
232
+ return;
233
+ }
234
+ const keyWidth = Math.max(...keys.map((k) => k.length));
235
+ for (const key of keys) {
236
+ const value = record[key];
237
+ const valueStr = value !== null && typeof value === "object" ? JSON.stringify(value) : String(value ?? "");
238
+ console.log(`${colors.cyan(key.padEnd(keyWidth))} ${valueStr}`);
239
+ }
240
+ }
241
+ success(message) {
242
+ if (this.format === "json") console.log(JSON.stringify({
243
+ status: "success",
244
+ message
245
+ }));
246
+ else console.log(colors.green(`✓ ${message}`));
247
+ }
248
+ error(message, details) {
249
+ if (this.format === "json") console.error(JSON.stringify({
250
+ status: "error",
251
+ message,
252
+ details
253
+ }));
254
+ else {
255
+ console.error(colors.red(`✗ ${message}`));
256
+ if (details !== void 0) console.error(details);
257
+ }
258
+ }
259
+ warning(message) {
260
+ if (this.format === "json") console.log(JSON.stringify({
261
+ status: "warning",
262
+ message
263
+ }));
264
+ else console.log(colors.yellow(`⚠ ${message}`));
265
+ }
266
+ info(message) {
267
+ if (this.format === "json") console.log(JSON.stringify({
268
+ status: "info",
269
+ message
270
+ }));
271
+ else console.log(colors.cyan(message));
272
+ }
273
+ outputTable(data) {
274
+ if (Array.isArray(data) && data.length > 0) {
275
+ const headers = Object.keys(data[0]);
276
+ const colWidths = headers.map((h) => {
277
+ const maxDataWidth = Math.max(...data.map((row) => String(row[h] ?? "").length));
278
+ return Math.max(h.length, maxDataWidth);
279
+ });
280
+ const headerRow = headers.map((h, i) => h.padEnd(colWidths[i])).join(" | ");
281
+ console.log(headerRow);
282
+ console.log(colWidths.map((w) => "-".repeat(w)).join("-+-"));
283
+ for (const row of data) {
284
+ const rowStr = headers.map((h, i) => String(row[h] ?? "").padEnd(colWidths[i])).join(" | ");
285
+ console.log(rowStr);
286
+ }
287
+ }
288
+ }
289
+ };
290
+ /**
291
+ * Creates a command context from CLI options.
292
+ */
293
+ function createContext(options = {}) {
294
+ return {
295
+ formatter: new OutputFormatter(options.format ?? options.f ?? "human", options["no-color"] === true),
296
+ options,
297
+ createExecutorContext(token) {
298
+ return { client: new HttpClient({ token }) };
299
+ },
300
+ getToken() {
301
+ if (typeof options.token === "string" && options.token) return options.token;
302
+ const stored = getToken$1(createConfigStore$1());
303
+ if (stored) return stored;
304
+ throw ConfigError.missingToken();
305
+ }
306
+ };
307
+ }
308
+ /**
309
+ * Creates a test context for unit tests.
310
+ *
311
+ * @example
312
+ * ```typescript
313
+ * const ctx = createTestContext({
314
+ * mockClient: { get: async () => ({ servers: [] }) } as never,
315
+ * });
316
+ * ```
317
+ */
318
+ function createTestContext(overrides) {
319
+ const opts = overrides.options ?? {
320
+ format: "json",
321
+ "no-color": true
322
+ };
323
+ const format = opts.format ?? "json";
324
+ return {
325
+ formatter: overrides.formatter ?? new OutputFormatter(format, true),
326
+ options: opts,
327
+ createExecutorContext(_token) {
328
+ if (!overrides.mockClient) throw new Error("createTestContext: provide mockClient to use createExecutorContext in tests");
329
+ return { client: overrides.mockClient };
330
+ },
331
+ getToken() {
332
+ if (overrides.token) return overrides.token;
333
+ if (typeof opts.token === "string") return opts.token;
334
+ return "test-token";
335
+ }
336
+ };
337
+ }
338
+ /**
339
+ * Exit codes for different error categories.
340
+ */
341
+ const ExitCode = {
342
+ SUCCESS: 0,
343
+ GENERAL_ERROR: 1,
344
+ AUTHENTICATION_ERROR: 2,
345
+ VALIDATION_ERROR: 3,
346
+ CONFIG_ERROR: 4,
347
+ NOT_FOUND_ERROR: 5
348
+ };
349
+ /**
350
+ * Determine the appropriate exit code for an error.
351
+ */
352
+ function getExitCode(error) {
353
+ if (error instanceof ValidationError) return ExitCode.VALIDATION_ERROR;
354
+ if (error instanceof ApiError) {
355
+ if (error.statusCode === 401) return ExitCode.AUTHENTICATION_ERROR;
356
+ if (error.statusCode === 404) return ExitCode.NOT_FOUND_ERROR;
357
+ }
358
+ if (isCliError(error) && error.code === "CONFIG_ERROR") return ExitCode.CONFIG_ERROR;
359
+ return ExitCode.GENERAL_ERROR;
360
+ }
361
+ /**
362
+ * Central error handler for all commands.
363
+ */
364
+ function handleError(error, formatter, options) {
365
+ const shouldExit = options?.exit ?? true;
366
+ let cliError;
367
+ if (isCliError(error)) cliError = error;
368
+ else cliError = ApiError.fromForgeError(error);
369
+ if (formatter.format === "json") formatter.output(cliError.toJSON());
370
+ else formatter.error(cliError.toFormattedMessage());
371
+ const exitCode = getExitCode(cliError);
372
+ if (shouldExit) process.exit(exitCode);
373
+ return exitCode;
374
+ }
375
+ /**
376
+ * Wraps a command function with automatic error handling.
377
+ */
378
+ async function runCommand(fn, formatter) {
379
+ try {
380
+ return await fn();
381
+ } catch (error) {
382
+ handleError(error, formatter);
383
+ return;
384
+ }
385
+ }
386
+ /**
387
+ * Exits with a validation error for a missing required argument.
388
+ */
389
+ function exitWithValidationError(field, usage, formatter) {
390
+ const error = ValidationError.required(field, [`Usage: ${usage}`]);
391
+ handleError(error, formatter);
392
+ throw error;
393
+ }
394
+ export { ConfigError as _, createContext as a, colors as c, deleteToken as d, getConfig as f, CliError as g, ApiError as h, runCommand as i, setColorEnabled as l, setToken as m, exitWithValidationError as n, createTestContext as o, getToken$1 as p, handleError as r, OutputFormatter as s, ExitCode as t, createConfigStore$1 as u, ValidationError as v, isCliError as y };
395
+
396
+ //# sourceMappingURL=error-handler-BahHMt6t.js.map