@nexical/cli 0.1.6 → 0.10.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 (236) hide show
  1. package/.github/workflows/deploy.yml +3 -3
  2. package/README.md +317 -104
  3. package/dist/chunk-JYASTIIW.js +42 -0
  4. package/dist/chunk-JYASTIIW.js.map +1 -0
  5. package/dist/chunk-LZ3YQWAR.js +2204 -0
  6. package/dist/chunk-LZ3YQWAR.js.map +1 -0
  7. package/dist/chunk-OKXOCNXP.js +105 -0
  8. package/dist/chunk-OKXOCNXP.js.map +1 -0
  9. package/dist/chunk-OYFWMYPG.js +52 -0
  10. package/dist/chunk-OYFWMYPG.js.map +1 -0
  11. package/dist/chunk-WKERTCM6.js +74 -0
  12. package/dist/chunk-WKERTCM6.js.map +1 -0
  13. package/dist/index.js +33 -6
  14. package/dist/index.js.map +1 -1
  15. package/dist/src/commands/init.d.ts +11 -0
  16. package/dist/src/commands/init.js +88 -0
  17. package/dist/src/commands/init.js.map +1 -0
  18. package/dist/src/commands/module/add.d.ts +14 -0
  19. package/dist/src/commands/module/add.js +136 -0
  20. package/dist/src/commands/module/add.js.map +1 -0
  21. package/dist/src/commands/module/list.d.ts +10 -0
  22. package/dist/src/commands/module/list.js +73 -0
  23. package/dist/src/commands/module/list.js.map +1 -0
  24. package/dist/src/commands/module/remove.d.ts +12 -0
  25. package/dist/src/commands/module/remove.js +71 -0
  26. package/dist/src/commands/module/remove.js.map +1 -0
  27. package/dist/src/commands/module/update.d.ts +11 -0
  28. package/dist/src/commands/module/update.js +52 -0
  29. package/dist/src/commands/module/update.js.map +1 -0
  30. package/dist/src/commands/run.d.ts +11 -0
  31. package/dist/src/commands/run.js +93 -0
  32. package/dist/src/commands/run.js.map +1 -0
  33. package/dist/src/utils/discovery.d.ts +13 -0
  34. package/dist/src/utils/discovery.js +9 -0
  35. package/dist/src/utils/git.d.ts +16 -0
  36. package/dist/src/utils/git.js +29 -0
  37. package/dist/src/utils/git.js.map +1 -0
  38. package/dist/src/utils/url-resolver.d.ts +15 -0
  39. package/dist/src/utils/url-resolver.js +9 -0
  40. package/dist/src/utils/url-resolver.js.map +1 -0
  41. package/index.ts +29 -5
  42. package/package.json +32 -30
  43. package/src/commands/init.ts +85 -0
  44. package/src/commands/module/add.ts +169 -0
  45. package/src/commands/module/list.ts +69 -0
  46. package/src/commands/module/remove.ts +74 -0
  47. package/src/commands/module/update.ts +50 -0
  48. package/src/commands/run.ts +98 -0
  49. package/src/utils/discovery.ts +134 -0
  50. package/src/utils/git.ts +65 -0
  51. package/src/utils/url-resolver.ts +57 -0
  52. package/test/e2e/lifecycle.e2e.test.ts +152 -0
  53. package/test/integration/commands/init.integration.test.ts +82 -0
  54. package/test/integration/commands/module.integration.test.ts +144 -0
  55. package/test/integration/commands/run.integration.test.ts +90 -0
  56. package/test/integration/utils/command-loading.integration.test.ts +80 -0
  57. package/test/unit/commands/init.test.ts +153 -0
  58. package/test/unit/commands/module/add.test.ts +262 -0
  59. package/test/unit/commands/module/list.test.ts +115 -0
  60. package/test/unit/commands/module/remove.test.ts +89 -0
  61. package/test/unit/commands/module/update.test.ts +91 -0
  62. package/test/unit/commands/run.test.ts +252 -0
  63. package/test/unit/utils/command-discovery.test.ts +176 -0
  64. package/test/unit/utils/git.test.ts +152 -0
  65. package/test/unit/utils/integration-helpers.test.ts +72 -0
  66. package/test/unit/utils/url-resolver.test.ts +39 -0
  67. package/test/utils/integration-helpers.ts +66 -0
  68. package/vitest.e2e.config.ts +0 -1
  69. package/dist/chunk-JDRAVUKK.js +0 -48
  70. package/dist/chunk-JDRAVUKK.js.map +0 -1
  71. package/dist/src/commands/admin/create-user.d.ts +0 -15
  72. package/dist/src/commands/admin/create-user.js +0 -49
  73. package/dist/src/commands/admin/create-user.js.map +0 -1
  74. package/dist/src/commands/branch/create.d.ts +0 -19
  75. package/dist/src/commands/branch/create.js +0 -59
  76. package/dist/src/commands/branch/create.js.map +0 -1
  77. package/dist/src/commands/branch/delete.d.ts +0 -15
  78. package/dist/src/commands/branch/delete.js +0 -50
  79. package/dist/src/commands/branch/delete.js.map +0 -1
  80. package/dist/src/commands/branch/get.d.ts +0 -15
  81. package/dist/src/commands/branch/get.js +0 -53
  82. package/dist/src/commands/branch/get.js.map +0 -1
  83. package/dist/src/commands/branch/list.d.ts +0 -15
  84. package/dist/src/commands/branch/list.js +0 -51
  85. package/dist/src/commands/branch/list.js.map +0 -1
  86. package/dist/src/commands/job/get.d.ts +0 -15
  87. package/dist/src/commands/job/get.js +0 -62
  88. package/dist/src/commands/job/get.js.map +0 -1
  89. package/dist/src/commands/job/list.d.ts +0 -15
  90. package/dist/src/commands/job/list.js +0 -57
  91. package/dist/src/commands/job/list.js.map +0 -1
  92. package/dist/src/commands/job/logs.d.ts +0 -15
  93. package/dist/src/commands/job/logs.js +0 -67
  94. package/dist/src/commands/job/logs.js.map +0 -1
  95. package/dist/src/commands/job/trigger.d.ts +0 -19
  96. package/dist/src/commands/job/trigger.js +0 -74
  97. package/dist/src/commands/job/trigger.js.map +0 -1
  98. package/dist/src/commands/login.d.ts +0 -8
  99. package/dist/src/commands/login.js +0 -31
  100. package/dist/src/commands/login.js.map +0 -1
  101. package/dist/src/commands/project/create.d.ts +0 -24
  102. package/dist/src/commands/project/create.js +0 -63
  103. package/dist/src/commands/project/create.js.map +0 -1
  104. package/dist/src/commands/project/delete.d.ts +0 -20
  105. package/dist/src/commands/project/delete.js +0 -58
  106. package/dist/src/commands/project/delete.js.map +0 -1
  107. package/dist/src/commands/project/get.d.ts +0 -15
  108. package/dist/src/commands/project/get.js +0 -49
  109. package/dist/src/commands/project/get.js.map +0 -1
  110. package/dist/src/commands/project/list.d.ts +0 -15
  111. package/dist/src/commands/project/list.js +0 -45
  112. package/dist/src/commands/project/list.js.map +0 -1
  113. package/dist/src/commands/project/update.d.ts +0 -19
  114. package/dist/src/commands/project/update.js +0 -66
  115. package/dist/src/commands/project/update.js.map +0 -1
  116. package/dist/src/commands/team/create.d.ts +0 -19
  117. package/dist/src/commands/team/create.js +0 -45
  118. package/dist/src/commands/team/create.js.map +0 -1
  119. package/dist/src/commands/team/delete.d.ts +0 -20
  120. package/dist/src/commands/team/delete.js +0 -52
  121. package/dist/src/commands/team/delete.js.map +0 -1
  122. package/dist/src/commands/team/get.d.ts +0 -15
  123. package/dist/src/commands/team/get.js +0 -42
  124. package/dist/src/commands/team/get.js.map +0 -1
  125. package/dist/src/commands/team/list.d.ts +0 -8
  126. package/dist/src/commands/team/list.js +0 -30
  127. package/dist/src/commands/team/list.js.map +0 -1
  128. package/dist/src/commands/team/member/invite.d.ts +0 -20
  129. package/dist/src/commands/team/member/invite.js +0 -54
  130. package/dist/src/commands/team/member/invite.js.map +0 -1
  131. package/dist/src/commands/team/member/remove.d.ts +0 -15
  132. package/dist/src/commands/team/member/remove.js +0 -43
  133. package/dist/src/commands/team/member/remove.js.map +0 -1
  134. package/dist/src/commands/team/update.d.ts +0 -19
  135. package/dist/src/commands/team/update.js +0 -55
  136. package/dist/src/commands/team/update.js.map +0 -1
  137. package/dist/src/commands/token/generate.d.ts +0 -19
  138. package/dist/src/commands/token/generate.js +0 -48
  139. package/dist/src/commands/token/generate.js.map +0 -1
  140. package/dist/src/commands/token/list.d.ts +0 -8
  141. package/dist/src/commands/token/list.js +0 -31
  142. package/dist/src/commands/token/list.js.map +0 -1
  143. package/dist/src/commands/token/revoke.d.ts +0 -15
  144. package/dist/src/commands/token/revoke.js +0 -38
  145. package/dist/src/commands/token/revoke.js.map +0 -1
  146. package/dist/src/commands/whoami.d.ts +0 -8
  147. package/dist/src/commands/whoami.js +0 -26
  148. package/dist/src/commands/whoami.js.map +0 -1
  149. package/dist/src/utils/nexical-client.d.ts +0 -10
  150. package/dist/src/utils/nexical-client.js +0 -12
  151. package/src/commands/admin/create-user.ts +0 -46
  152. package/src/commands/branch/create.ts +0 -57
  153. package/src/commands/branch/delete.ts +0 -47
  154. package/src/commands/branch/get.ts +0 -50
  155. package/src/commands/branch/list.ts +0 -50
  156. package/src/commands/job/get.ts +0 -59
  157. package/src/commands/job/list.ts +0 -56
  158. package/src/commands/job/logs.ts +0 -67
  159. package/src/commands/job/trigger.ts +0 -73
  160. package/src/commands/login.ts +0 -31
  161. package/src/commands/project/create.ts +0 -61
  162. package/src/commands/project/delete.ts +0 -56
  163. package/src/commands/project/get.ts +0 -46
  164. package/src/commands/project/list.ts +0 -44
  165. package/src/commands/project/update.ts +0 -63
  166. package/src/commands/team/create.ts +0 -43
  167. package/src/commands/team/delete.ts +0 -50
  168. package/src/commands/team/get.ts +0 -39
  169. package/src/commands/team/list.ts +0 -26
  170. package/src/commands/team/member/invite.ts +0 -56
  171. package/src/commands/team/member/remove.ts +0 -40
  172. package/src/commands/team/update.ts +0 -53
  173. package/src/commands/token/generate.ts +0 -45
  174. package/src/commands/token/list.ts +0 -27
  175. package/src/commands/token/revoke.ts +0 -35
  176. package/src/commands/whoami.ts +0 -21
  177. package/src/utils/nexical-client.ts +0 -47
  178. package/test/e2e/auth.e2e.test.ts +0 -46
  179. package/test/e2e/job-workflow.e2e.test.ts +0 -33
  180. package/test/e2e/project-lifecycle.e2e.test.ts +0 -48
  181. package/test/e2e/setup.ts +0 -237
  182. package/test/e2e/utils.ts +0 -33
  183. package/test/integration/commands/admin/create-user.test.ts +0 -51
  184. package/test/integration/commands/branch/create.test.ts +0 -51
  185. package/test/integration/commands/branch/delete.test.ts +0 -43
  186. package/test/integration/commands/branch/get.test.ts +0 -49
  187. package/test/integration/commands/branch/list.test.ts +0 -47
  188. package/test/integration/commands/job/get.test.ts +0 -54
  189. package/test/integration/commands/job/list.test.ts +0 -47
  190. package/test/integration/commands/job/logs.test.ts +0 -47
  191. package/test/integration/commands/job/trigger.test.ts +0 -57
  192. package/test/integration/commands/login.test.ts +0 -62
  193. package/test/integration/commands/project/create.test.ts +0 -53
  194. package/test/integration/commands/project/delete.test.ts +0 -43
  195. package/test/integration/commands/project/get.test.ts +0 -51
  196. package/test/integration/commands/project/list.test.ts +0 -47
  197. package/test/integration/commands/project/update.test.ts +0 -53
  198. package/test/integration/commands/team/create.test.ts +0 -53
  199. package/test/integration/commands/team/delete.test.ts +0 -43
  200. package/test/integration/commands/team/get.test.ts +0 -50
  201. package/test/integration/commands/team/list.test.ts +0 -47
  202. package/test/integration/commands/team/member/invite.test.ts +0 -46
  203. package/test/integration/commands/team/member/remove.test.ts +0 -43
  204. package/test/integration/commands/team/update.test.ts +0 -50
  205. package/test/integration/commands/token/generate.test.ts +0 -51
  206. package/test/integration/commands/token/list.test.ts +0 -47
  207. package/test/integration/commands/token/revoke.test.ts +0 -43
  208. package/test/integration/commands/whoami.test.ts +0 -49
  209. package/test/unit/commands/admin/create-user.test.ts +0 -51
  210. package/test/unit/commands/branch/create.test.ts +0 -57
  211. package/test/unit/commands/branch/delete.test.ts +0 -49
  212. package/test/unit/commands/branch/get.test.ts +0 -67
  213. package/test/unit/commands/branch/list.test.ts +0 -62
  214. package/test/unit/commands/job/get.test.ts +0 -76
  215. package/test/unit/commands/job/list.test.ts +0 -62
  216. package/test/unit/commands/job/logs.test.ts +0 -60
  217. package/test/unit/commands/job/trigger.test.ts +0 -75
  218. package/test/unit/commands/login.test.ts +0 -64
  219. package/test/unit/commands/project/create.test.ts +0 -64
  220. package/test/unit/commands/project/delete.test.ts +0 -72
  221. package/test/unit/commands/project/get.test.ts +0 -73
  222. package/test/unit/commands/project/list.test.ts +0 -62
  223. package/test/unit/commands/project/update.test.ts +0 -58
  224. package/test/unit/commands/team/create.test.ts +0 -68
  225. package/test/unit/commands/team/delete.test.ts +0 -71
  226. package/test/unit/commands/team/get.test.ts +0 -70
  227. package/test/unit/commands/team/list.test.ts +0 -56
  228. package/test/unit/commands/team/member/invite.test.ts +0 -52
  229. package/test/unit/commands/team/member/remove.test.ts +0 -49
  230. package/test/unit/commands/team/update.test.ts +0 -63
  231. package/test/unit/commands/token/generate.test.ts +0 -65
  232. package/test/unit/commands/token/list.test.ts +0 -58
  233. package/test/unit/commands/token/revoke.test.ts +0 -49
  234. package/test/unit/commands/whoami.test.ts +0 -49
  235. package/test/unit/utils/nexical-client.test.ts +0 -113
  236. /package/dist/src/utils/{nexical-client.js.map → discovery.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/commands/team/update.ts"],"sourcesContent":["\nimport { BaseCommand } from '@nexical/cli-core';\nimport { getClient } from '../../utils/nexical-client.js';\n\nexport default class TeamsUpdateCommand extends BaseCommand {\n static description = 'Update team details';\n\n static args = {\n args: [\n {\n name: 'teamId',\n required: true,\n description: 'Team ID',\n },\n ],\n options: [\n {\n name: '--name <name>',\n description: 'New name',\n },\n {\n name: '--slug <slug>',\n description: 'New slug',\n },\n ],\n };\n\n async run(options: any) {\n const client = getClient();\n const { teamId, name, slug } = options;\n const tid = parseInt(teamId, 10);\n\n if (isNaN(tid)) {\n this.error('Team ID must be a number.');\n return;\n }\n\n if (!name && !slug) {\n this.warn('No updates provided. Use --name or --slug.');\n return;\n }\n\n try {\n const team = await client.teams.update(tid, {\n name,\n });\n this.success(`Team ${team.id} updated!`);\n this.info(`Name: ${team.name}`);\n } catch (error: any) {\n this.error(`Failed to update team: ${error.message}`);\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAS,mBAAmB;AAG5B,IAAqB,qBAArB,cAAgD,YAAY;AAAA,EACxD,OAAO,cAAc;AAAA,EAErB,OAAO,OAAO;AAAA,IACV,MAAM;AAAA,MACF;AAAA,QACI,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACjB;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,MACL;AAAA,QACI,MAAM;AAAA,QACN,aAAa;AAAA,MACjB;AAAA,MACA;AAAA,QACI,MAAM;AAAA,QACN,aAAa;AAAA,MACjB;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,MAAM,IAAI,SAAc;AACpB,UAAM,SAAS,UAAU;AACzB,UAAM,EAAE,QAAQ,MAAM,KAAK,IAAI;AAC/B,UAAM,MAAM,SAAS,QAAQ,EAAE;AAE/B,QAAI,MAAM,GAAG,GAAG;AACZ,WAAK,MAAM,2BAA2B;AACtC;AAAA,IACJ;AAEA,QAAI,CAAC,QAAQ,CAAC,MAAM;AAChB,WAAK,KAAK,4CAA4C;AACtD;AAAA,IACJ;AAEA,QAAI;AACA,YAAM,OAAO,MAAM,OAAO,MAAM,OAAO,KAAK;AAAA,QACxC;AAAA,MACJ,CAAC;AACD,WAAK,QAAQ,QAAQ,KAAK,EAAE,WAAW;AACvC,WAAK,KAAK,SAAS,KAAK,IAAI,EAAE;AAAA,IAClC,SAAS,OAAY;AACjB,WAAK,MAAM,0BAA0B,MAAM,OAAO,EAAE;AAAA,IACxD;AAAA,EACJ;AACJ;","names":[]}
@@ -1,19 +0,0 @@
1
- import { BaseCommand } from '@nexical/cli-core';
2
-
3
- declare class AuthTokensGenerateCommand extends BaseCommand {
4
- static description: string;
5
- static args: {
6
- args: {
7
- name: string;
8
- required: boolean;
9
- description: string;
10
- }[];
11
- options: {
12
- name: string;
13
- description: string;
14
- }[];
15
- };
16
- run(options: any): Promise<void>;
17
- }
18
-
19
- export { AuthTokensGenerateCommand as default };
@@ -1,48 +0,0 @@
1
- import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
- import {
3
- getClient
4
- } from "../../../chunk-JDRAVUKK.js";
5
-
6
- // src/commands/token/generate.ts
7
- import { BaseCommand } from "@nexical/cli-core";
8
- var AuthTokensGenerateCommand = class extends BaseCommand {
9
- static description = "Generate a new API token";
10
- static args = {
11
- args: [
12
- {
13
- name: "name",
14
- required: true,
15
- description: "Name of the token"
16
- }
17
- ],
18
- options: [
19
- {
20
- name: "--scopes <scopes>",
21
- description: "Comma-separated list of scopes"
22
- },
23
- {
24
- name: "--expires <isoDate>",
25
- description: "Expiration date (ISO 8601)"
26
- }
27
- ]
28
- };
29
- async run(options) {
30
- const client = getClient();
31
- const { name, scopes, expires } = options;
32
- try {
33
- const token = await client.auth.generateToken({
34
- name,
35
- scopes: scopes ? scopes.split(",") : void 0
36
- });
37
- this.success(`Token "${name}" generated!`);
38
- this.warn(`Token: ${token.token}`);
39
- this.warn("Make sure to copy it now. You won't be able to see it again!");
40
- } catch (error) {
41
- this.error(`Failed to generate token: ${error.message}`);
42
- }
43
- }
44
- };
45
- export {
46
- AuthTokensGenerateCommand as default
47
- };
48
- //# sourceMappingURL=generate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/commands/token/generate.ts"],"sourcesContent":["\nimport { BaseCommand } from '@nexical/cli-core';\nimport { getClient } from '../../utils/nexical-client.js';\n\nexport default class AuthTokensGenerateCommand extends BaseCommand {\n static description = 'Generate a new API token';\n\n static args = {\n args: [\n {\n name: 'name',\n required: true,\n description: 'Name of the token',\n },\n ],\n options: [\n {\n name: '--scopes <scopes>',\n description: 'Comma-separated list of scopes',\n },\n {\n name: '--expires <isoDate>',\n description: 'Expiration date (ISO 8601)',\n },\n ],\n };\n\n async run(options: any) {\n const client = getClient();\n const { name, scopes, expires } = options;\n\n try {\n const token = await client.auth.generateToken({\n name,\n scopes: scopes ? scopes.split(',') : undefined,\n });\n\n this.success(`Token \"${name}\" generated!`);\n this.warn(`Token: ${token.token}`);\n this.warn('Make sure to copy it now. You won\\'t be able to see it again!');\n } catch (error: any) {\n this.error(`Failed to generate token: ${error.message}`);\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAS,mBAAmB;AAG5B,IAAqB,4BAArB,cAAuD,YAAY;AAAA,EAC/D,OAAO,cAAc;AAAA,EAErB,OAAO,OAAO;AAAA,IACV,MAAM;AAAA,MACF;AAAA,QACI,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACjB;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,MACL;AAAA,QACI,MAAM;AAAA,QACN,aAAa;AAAA,MACjB;AAAA,MACA;AAAA,QACI,MAAM;AAAA,QACN,aAAa;AAAA,MACjB;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,MAAM,IAAI,SAAc;AACpB,UAAM,SAAS,UAAU;AACzB,UAAM,EAAE,MAAM,QAAQ,QAAQ,IAAI;AAElC,QAAI;AACA,YAAM,QAAQ,MAAM,OAAO,KAAK,cAAc;AAAA,QAC1C;AAAA,QACA,QAAQ,SAAS,OAAO,MAAM,GAAG,IAAI;AAAA,MACzC,CAAC;AAED,WAAK,QAAQ,UAAU,IAAI,cAAc;AACzC,WAAK,KAAK,UAAU,MAAM,KAAK,EAAE;AACjC,WAAK,KAAK,8DAA+D;AAAA,IAC7E,SAAS,OAAY;AACjB,WAAK,MAAM,6BAA6B,MAAM,OAAO,EAAE;AAAA,IAC3D;AAAA,EACJ;AACJ;","names":[]}
@@ -1,8 +0,0 @@
1
- import { BaseCommand } from '@nexical/cli-core';
2
-
3
- declare class AuthTokensListCommand extends BaseCommand {
4
- static description: string;
5
- run(): Promise<void>;
6
- }
7
-
8
- export { AuthTokensListCommand as default };
@@ -1,31 +0,0 @@
1
- import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
- import {
3
- getClient
4
- } from "../../../chunk-JDRAVUKK.js";
5
-
6
- // src/commands/token/list.ts
7
- import { BaseCommand } from "@nexical/cli-core";
8
- var AuthTokensListCommand = class extends BaseCommand {
9
- static description = "List your API tokens";
10
- async run() {
11
- const client = getClient();
12
- try {
13
- const response = await client.auth.listTokens();
14
- const tokens = response.tokens;
15
- if (tokens.length === 0) {
16
- this.info("No API tokens found.");
17
- return;
18
- }
19
- this.info("Your API Tokens:");
20
- for (const token of tokens) {
21
- this.info(`- ${token.name} (${token.tokenPrefix}...) [Expires: ${token.expiresAt || "Never"}]`);
22
- }
23
- } catch (error) {
24
- this.error(`Failed to list tokens: ${error.message}`);
25
- }
26
- }
27
- };
28
- export {
29
- AuthTokensListCommand as default
30
- };
31
- //# sourceMappingURL=list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/commands/token/list.ts"],"sourcesContent":["\nimport { BaseCommand } from '@nexical/cli-core';\nimport { getClient } from '../../utils/nexical-client.js';\n\nexport default class AuthTokensListCommand extends BaseCommand {\n static description = 'List your API tokens';\n\n async run() {\n const client = getClient();\n try {\n const response = await client.auth.listTokens();\n const tokens = response.tokens;\n\n if (tokens.length === 0) {\n this.info('No API tokens found.');\n return;\n }\n\n this.info('Your API Tokens:');\n for (const token of tokens) {\n this.info(`- ${token.name} (${token.tokenPrefix}...) [Expires: ${token.expiresAt || 'Never'}]`);\n }\n } catch (error: any) {\n this.error(`Failed to list tokens: ${error.message}`);\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAS,mBAAmB;AAG5B,IAAqB,wBAArB,cAAmD,YAAY;AAAA,EAC3D,OAAO,cAAc;AAAA,EAErB,MAAM,MAAM;AACR,UAAM,SAAS,UAAU;AACzB,QAAI;AACA,YAAM,WAAW,MAAM,OAAO,KAAK,WAAW;AAC9C,YAAM,SAAS,SAAS;AAExB,UAAI,OAAO,WAAW,GAAG;AACrB,aAAK,KAAK,sBAAsB;AAChC;AAAA,MACJ;AAEA,WAAK,KAAK,kBAAkB;AAC5B,iBAAW,SAAS,QAAQ;AACxB,aAAK,KAAK,KAAK,MAAM,IAAI,KAAK,MAAM,WAAW,kBAAkB,MAAM,aAAa,OAAO,GAAG;AAAA,MAClG;AAAA,IACJ,SAAS,OAAY;AACjB,WAAK,MAAM,0BAA0B,MAAM,OAAO,EAAE;AAAA,IACxD;AAAA,EACJ;AACJ;","names":[]}
@@ -1,15 +0,0 @@
1
- import { BaseCommand } from '@nexical/cli-core';
2
-
3
- declare class AuthTokensRevokeCommand extends BaseCommand {
4
- static description: string;
5
- static args: {
6
- args: {
7
- name: string;
8
- required: boolean;
9
- description: string;
10
- }[];
11
- };
12
- run(options: any): Promise<void>;
13
- }
14
-
15
- export { AuthTokensRevokeCommand as default };
@@ -1,38 +0,0 @@
1
- import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
- import {
3
- getClient
4
- } from "../../../chunk-JDRAVUKK.js";
5
-
6
- // src/commands/token/revoke.ts
7
- import { BaseCommand } from "@nexical/cli-core";
8
- var AuthTokensRevokeCommand = class extends BaseCommand {
9
- static description = "Revoke an API token";
10
- static args = {
11
- args: [
12
- {
13
- name: "id",
14
- required: true,
15
- description: "ID of the token to revoke"
16
- }
17
- ]
18
- };
19
- async run(options) {
20
- const client = getClient();
21
- const { id } = options;
22
- const tid = parseInt(id, 10);
23
- if (isNaN(tid)) {
24
- this.error("Token ID must be a number.");
25
- return;
26
- }
27
- try {
28
- await client.auth.revokeToken(tid);
29
- this.success(`Token ${tid} revoked.`);
30
- } catch (error) {
31
- this.error(`Failed to revoke token: ${error.message}`);
32
- }
33
- }
34
- };
35
- export {
36
- AuthTokensRevokeCommand as default
37
- };
38
- //# sourceMappingURL=revoke.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/commands/token/revoke.ts"],"sourcesContent":["\nimport { BaseCommand } from '@nexical/cli-core';\nimport { getClient } from '../../utils/nexical-client.js';\n\nexport default class AuthTokensRevokeCommand extends BaseCommand {\n static description = 'Revoke an API token';\n\n static args = {\n args: [\n {\n name: 'id',\n required: true,\n description: 'ID of the token to revoke',\n },\n ],\n };\n\n async run(options: any) {\n const client = getClient();\n const { id } = options;\n const tid = parseInt(id, 10);\n\n if (isNaN(tid)) {\n this.error('Token ID must be a number.');\n return;\n }\n\n try {\n await client.auth.revokeToken(tid);\n this.success(`Token ${tid} revoked.`);\n } catch (error: any) {\n this.error(`Failed to revoke token: ${error.message}`);\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAS,mBAAmB;AAG5B,IAAqB,0BAArB,cAAqD,YAAY;AAAA,EAC7D,OAAO,cAAc;AAAA,EAErB,OAAO,OAAO;AAAA,IACV,MAAM;AAAA,MACF;AAAA,QACI,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACjB;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,MAAM,IAAI,SAAc;AACpB,UAAM,SAAS,UAAU;AACzB,UAAM,EAAE,GAAG,IAAI;AACf,UAAM,MAAM,SAAS,IAAI,EAAE;AAE3B,QAAI,MAAM,GAAG,GAAG;AACZ,WAAK,MAAM,4BAA4B;AACvC;AAAA,IACJ;AAEA,QAAI;AACA,YAAM,OAAO,KAAK,YAAY,GAAG;AACjC,WAAK,QAAQ,SAAS,GAAG,WAAW;AAAA,IACxC,SAAS,OAAY;AACjB,WAAK,MAAM,2BAA2B,MAAM,OAAO,EAAE;AAAA,IACzD;AAAA,EACJ;AACJ;","names":[]}
@@ -1,8 +0,0 @@
1
- import { BaseCommand } from '@nexical/cli-core';
2
-
3
- declare class WhoamiCommand extends BaseCommand {
4
- static description: string;
5
- run(): Promise<void>;
6
- }
7
-
8
- export { WhoamiCommand as default };
@@ -1,26 +0,0 @@
1
- import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
- import {
3
- getClient
4
- } from "../../chunk-JDRAVUKK.js";
5
-
6
- // src/commands/whoami.ts
7
- import { BaseCommand } from "@nexical/cli-core";
8
- var WhoamiCommand = class extends BaseCommand {
9
- static description = "Show current logged in user";
10
- async run() {
11
- const client = getClient();
12
- try {
13
- const user = await client.users.me();
14
- this.info(`Logged in as:`);
15
- this.info(` Name: ${user.fullName}`);
16
- this.info(` Email: ${user.email}`);
17
- this.info(` ID: ${user.id}`);
18
- } catch (error) {
19
- this.error("Not logged in or token expired. Run `astrical login`.");
20
- }
21
- }
22
- };
23
- export {
24
- WhoamiCommand as default
25
- };
26
- //# sourceMappingURL=whoami.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/commands/whoami.ts"],"sourcesContent":["\nimport { BaseCommand } from '@nexical/cli-core';\nimport { getClient } from '../utils/nexical-client.js';\n\nexport default class WhoamiCommand extends BaseCommand {\n static description = 'Show current logged in user';\n\n async run() {\n const client = getClient();\n\n try {\n const user = await client.users.me();\n this.info(`Logged in as:`);\n this.info(` Name: ${user.fullName}`);\n this.info(` Email: ${user.email}`);\n this.info(` ID: ${user.id}`);\n } catch (error: any) {\n this.error('Not logged in or token expired. Run `astrical login`.');\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAS,mBAAmB;AAG5B,IAAqB,gBAArB,cAA2C,YAAY;AAAA,EACnD,OAAO,cAAc;AAAA,EAErB,MAAM,MAAM;AACR,UAAM,SAAS,UAAU;AAEzB,QAAI;AACA,YAAM,OAAO,MAAM,OAAO,MAAM,GAAG;AACnC,WAAK,KAAK,eAAe;AACzB,WAAK,KAAK,YAAY,KAAK,QAAQ,EAAE;AACrC,WAAK,KAAK,YAAY,KAAK,KAAK,EAAE;AAClC,WAAK,KAAK,YAAY,KAAK,EAAE,EAAE;AAAA,IACnC,SAAS,OAAY;AACjB,WAAK,MAAM,uDAAuD;AAAA,IACtE;AAAA,EACJ;AACJ;","names":[]}
@@ -1,10 +0,0 @@
1
- import { NexicalClient } from '@nexical/sdk';
2
-
3
- interface Config {
4
- token?: string;
5
- }
6
- declare function getConfig(): Config;
7
- declare function saveToken(token: string): void;
8
- declare function getClient(): NexicalClient;
9
-
10
- export { getClient, getConfig, saveToken };
@@ -1,12 +0,0 @@
1
- import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
- import {
3
- getClient,
4
- getConfig,
5
- saveToken
6
- } from "../../chunk-JDRAVUKK.js";
7
- export {
8
- getClient,
9
- getConfig,
10
- saveToken
11
- };
12
- //# sourceMappingURL=nexical-client.js.map
@@ -1,46 +0,0 @@
1
-
2
- import { BaseCommand } from '@nexical/cli-core';
3
- import { getClient } from '../../utils/nexical-client.js';
4
-
5
- export default class AdminUsersCreateSystemCommand extends BaseCommand {
6
- static description = 'Create a new system user';
7
-
8
- static args = {
9
- args: [
10
- {
11
- name: 'name',
12
- required: true,
13
- description: 'System user name',
14
- },
15
- {
16
- name: 'email',
17
- required: true,
18
- description: 'System user email',
19
- },
20
- {
21
- name: 'password',
22
- required: true,
23
- description: 'System user password',
24
- },
25
- ],
26
- };
27
-
28
- async run(options: any) {
29
- const client = getClient();
30
- const { name, email, password } = options;
31
-
32
- try {
33
- const response = await client.auth.createSystemUser({
34
- fullName: name,
35
- email,
36
- password,
37
- });
38
- const user = response.user;
39
-
40
- this.success(`System user "${user.fullName}" created!`);
41
- this.info(`ID: ${user.id}`);
42
- } catch (error: any) {
43
- this.error(`Failed to create system user: ${error.message}`);
44
- }
45
- }
46
- }
@@ -1,57 +0,0 @@
1
-
2
- import { BaseCommand } from '@nexical/cli-core';
3
- import { getClient } from '../../utils/nexical-client.js';
4
-
5
- export default class BranchesCreateCommand extends BaseCommand {
6
- static description = 'Create a new branch';
7
-
8
- static args = {
9
- args: [
10
- {
11
- name: 'teamId',
12
- required: true,
13
- description: 'Team ID',
14
- },
15
- {
16
- name: 'projectId',
17
- required: true,
18
- description: 'Project ID',
19
- },
20
- {
21
- name: 'name',
22
- required: true,
23
- description: 'Name of the branch',
24
- },
25
- ],
26
- options: [
27
- {
28
- name: '--preview <url>',
29
- description: 'Preview URL',
30
- },
31
- ],
32
- };
33
-
34
- async run(options: any) {
35
- const client = getClient();
36
- const { teamId, projectId, name, preview } = options;
37
- const tid = parseInt(teamId, 10);
38
- const pid = parseInt(projectId, 10);
39
-
40
- if (isNaN(tid) || isNaN(pid)) {
41
- this.error('IDs must be numbers.');
42
- return;
43
- }
44
-
45
- try {
46
- const branch = await client.branches.create(tid, pid, {
47
- name,
48
- previewUrl: preview,
49
- });
50
-
51
- this.success(`Branch "${branch.name}" created!`);
52
- this.info(`ID: ${branch.id}`);
53
- } catch (error: any) {
54
- this.error(`Failed to create branch: ${error.message}`);
55
- }
56
- }
57
- }
@@ -1,47 +0,0 @@
1
-
2
- import { BaseCommand } from '@nexical/cli-core';
3
- import { getClient } from '../../utils/nexical-client.js';
4
-
5
- export default class BranchesDeleteCommand extends BaseCommand {
6
- static description = 'Delete a branch';
7
-
8
- static args = {
9
- args: [
10
- {
11
- name: 'teamId',
12
- required: true,
13
- description: 'Team ID',
14
- },
15
- {
16
- name: 'projectId',
17
- required: true,
18
- description: 'Project ID',
19
- },
20
- {
21
- name: 'branchId',
22
- required: true,
23
- description: 'Branch ID',
24
- },
25
- ],
26
- };
27
-
28
- async run(options: any) {
29
- const client = getClient();
30
- const { teamId, projectId, branchId } = options;
31
- const tid = parseInt(teamId, 10);
32
- const pid = parseInt(projectId, 10);
33
- const bid = parseInt(branchId, 10);
34
-
35
- if (isNaN(tid) || isNaN(pid) || isNaN(bid)) {
36
- this.error('IDs must be numbers.');
37
- return;
38
- }
39
-
40
- try {
41
- await client.branches.delete(tid, pid, bid);
42
- this.success(`Branch ${bid} deleted.`);
43
- } catch (error: any) {
44
- this.error(`Failed to delete branch: ${error.message}`);
45
- }
46
- }
47
- }
@@ -1,50 +0,0 @@
1
-
2
- import { BaseCommand } from '@nexical/cli-core';
3
- import { getClient } from '../../utils/nexical-client.js';
4
-
5
- export default class BranchesGetCommand extends BaseCommand {
6
- static description = 'Get branch details';
7
-
8
- static args = {
9
- args: [
10
- {
11
- name: 'teamId',
12
- required: true,
13
- description: 'Team ID',
14
- },
15
- {
16
- name: 'projectId',
17
- required: true,
18
- description: 'Project ID',
19
- },
20
- {
21
- name: 'branchId',
22
- required: true,
23
- description: 'Branch ID',
24
- },
25
- ],
26
- };
27
-
28
- async run(options: any) {
29
- const client = getClient();
30
- const { teamId, projectId, branchId } = options;
31
- const tid = parseInt(teamId, 10);
32
- const pid = parseInt(projectId, 10);
33
- const bid = parseInt(branchId, 10);
34
-
35
- if (isNaN(tid) || isNaN(pid) || isNaN(bid)) {
36
- this.error('IDs must be numbers.');
37
- return;
38
- }
39
-
40
- try {
41
- const branch = await client.branches.get(tid, pid, bid);
42
- this.info(`Branch Details:`);
43
- this.info(` ID: ${branch.id}`);
44
- this.info(` Name: ${branch.name}`);
45
- this.info(` Preview: ${branch.previewUrl || 'N/A'}`);
46
- } catch (error: any) {
47
- this.error(`Failed to get branch: ${error.message}`);
48
- }
49
- }
50
- }
@@ -1,50 +0,0 @@
1
-
2
- import { BaseCommand } from '@nexical/cli-core';
3
- import { getClient } from '../../utils/nexical-client.js';
4
-
5
- export default class BranchesListCommand extends BaseCommand {
6
- static description = 'List branches in a project';
7
-
8
- static args = {
9
- args: [
10
- {
11
- name: 'teamId',
12
- required: true,
13
- description: 'Team ID',
14
- },
15
- {
16
- name: 'projectId',
17
- required: true,
18
- description: 'Project ID',
19
- },
20
- ],
21
- };
22
-
23
- async run(options: any) {
24
- const client = getClient();
25
- const { teamId, projectId } = options;
26
- const tid = parseInt(teamId, 10);
27
- const pid = parseInt(projectId, 10);
28
-
29
- if (isNaN(tid) || isNaN(pid)) {
30
- this.error('IDs must be numbers.');
31
- return;
32
- }
33
-
34
- try {
35
- const branches = await client.branches.list(tid, pid);
36
-
37
- if (branches.length === 0) {
38
- this.info('No branches found.');
39
- return;
40
- }
41
-
42
- this.info(`Branches for Project ${pid}:`);
43
- for (const branch of branches) {
44
- this.info(`- ${branch.name} (ID: ${branch.id})`);
45
- }
46
- } catch (error: any) {
47
- this.error(`Failed to list branches: ${error.message}`);
48
- }
49
- }
50
- }
@@ -1,59 +0,0 @@
1
-
2
- import { BaseCommand } from '@nexical/cli-core';
3
- import { getClient } from '../../utils/nexical-client.js';
4
-
5
- export default class JobsGetCommand extends BaseCommand {
6
- static description = 'Get job details';
7
-
8
- static args = {
9
- args: [
10
- {
11
- name: 'teamId',
12
- required: true,
13
- description: 'Team ID',
14
- },
15
- {
16
- name: 'projectId',
17
- required: true,
18
- description: 'Project ID',
19
- },
20
- {
21
- name: 'branchId',
22
- required: true,
23
- description: 'Branch ID',
24
- },
25
- {
26
- name: 'jobId',
27
- required: true,
28
- description: 'Job ID',
29
- },
30
- ],
31
- };
32
-
33
- async run(options: any) {
34
- const client = getClient();
35
- const { teamId, projectId, branchId, jobId } = options;
36
- const tid = parseInt(teamId, 10);
37
- const pid = parseInt(projectId, 10);
38
- const bid = parseInt(branchId, 10);
39
- const jid = parseInt(jobId, 10);
40
-
41
- if (isNaN(tid) || isNaN(pid) || isNaN(bid) || isNaN(jid)) {
42
- this.error('IDs must be numbers.');
43
- return;
44
- }
45
-
46
- try {
47
- const job = await client.jobs.get(tid, pid, bid, jid);
48
- this.info(`Job Details:`);
49
- this.info(` ID: ${job.id}`);
50
- this.info(` Type: ${job.type}`);
51
- this.info(` Status: ${job.status}`);
52
- this.info(` Started: ${job.startedAt || 'Waiting'}`);
53
- this.info(` Ended: ${job.completedAt || 'Running'}`);
54
- this.info(` Queue: ${job.queue}`);
55
- } catch (error: any) {
56
- this.error(`Failed to get job: ${error.message}`);
57
- }
58
- }
59
- }
@@ -1,56 +0,0 @@
1
-
2
- import { BaseCommand } from '@nexical/cli-core';
3
- import { getClient } from '../../utils/nexical-client.js';
4
-
5
- export default class JobsListCommand extends BaseCommand {
6
- static description = 'List jobs for a branch';
7
-
8
- static args = {
9
- args: [
10
- {
11
- name: 'teamId',
12
- required: true,
13
- description: 'Team ID',
14
- },
15
- {
16
- name: 'projectId',
17
- required: true,
18
- description: 'Project ID',
19
- },
20
- {
21
- name: 'branchId',
22
- required: true,
23
- description: 'Branch ID',
24
- },
25
- ],
26
- };
27
-
28
- async run(options: any) {
29
- const client = getClient();
30
- const { teamId, projectId, branchId } = options;
31
- const tid = parseInt(teamId, 10);
32
- const pid = parseInt(projectId, 10);
33
- const bid = parseInt(branchId, 10);
34
-
35
- if (isNaN(tid) || isNaN(pid) || isNaN(bid)) {
36
- this.error('IDs must be numbers.');
37
- return;
38
- }
39
-
40
- try {
41
- const jobs = await client.jobs.list(tid, pid, bid);
42
-
43
- if (jobs.length === 0) {
44
- this.info('No jobs found.');
45
- return;
46
- }
47
-
48
- this.info(`Jobs for Branch ${bid}:`);
49
- for (const job of jobs) {
50
- this.info(`${job.id} - ${job.type} [${job.status}] (Started: ${job.startedAt || 'Waiting'})`);
51
- }
52
- } catch (error: any) {
53
- this.error(`Failed to list jobs: ${error.message}`);
54
- }
55
- }
56
- }