@nexical/cli 0.1.7 → 0.11.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 (241) hide show
  1. package/.github/workflows/deploy.yml +3 -3
  2. package/GEMINI.md +193 -0
  3. package/README.md +317 -104
  4. package/dist/chunk-JYASTIIW.js +42 -0
  5. package/dist/chunk-JYASTIIW.js.map +1 -0
  6. package/dist/chunk-LZ3YQWAR.js +2204 -0
  7. package/dist/chunk-LZ3YQWAR.js.map +1 -0
  8. package/dist/chunk-OKXOCNXP.js +105 -0
  9. package/dist/chunk-OKXOCNXP.js.map +1 -0
  10. package/dist/chunk-OYFWMYPG.js +52 -0
  11. package/dist/chunk-OYFWMYPG.js.map +1 -0
  12. package/dist/chunk-WKERTCM6.js +74 -0
  13. package/dist/chunk-WKERTCM6.js.map +1 -0
  14. package/dist/index.js +32 -5
  15. package/dist/index.js.map +1 -1
  16. package/dist/src/commands/init.d.ts +11 -0
  17. package/dist/src/commands/init.js +89 -0
  18. package/dist/src/commands/init.js.map +1 -0
  19. package/dist/src/commands/module/add.d.ts +14 -0
  20. package/dist/src/commands/module/add.js +136 -0
  21. package/dist/src/commands/module/add.js.map +1 -0
  22. package/dist/src/commands/module/list.d.ts +10 -0
  23. package/dist/src/commands/module/list.js +73 -0
  24. package/dist/src/commands/module/list.js.map +1 -0
  25. package/dist/src/commands/module/remove.d.ts +12 -0
  26. package/dist/src/commands/module/remove.js +71 -0
  27. package/dist/src/commands/module/remove.js.map +1 -0
  28. package/dist/src/commands/module/update.d.ts +11 -0
  29. package/dist/src/commands/module/update.js +52 -0
  30. package/dist/src/commands/module/update.js.map +1 -0
  31. package/dist/src/commands/run.d.ts +11 -0
  32. package/dist/src/commands/run.js +93 -0
  33. package/dist/src/commands/run.js.map +1 -0
  34. package/dist/src/commands/{login.d.ts → setup.d.ts} +2 -2
  35. package/dist/src/commands/setup.js +62 -0
  36. package/dist/src/commands/setup.js.map +1 -0
  37. package/dist/src/utils/discovery.d.ts +13 -0
  38. package/dist/src/utils/discovery.js +9 -0
  39. package/dist/src/utils/git.d.ts +16 -0
  40. package/dist/src/utils/git.js +29 -0
  41. package/dist/src/utils/git.js.map +1 -0
  42. package/dist/src/utils/url-resolver.d.ts +15 -0
  43. package/dist/src/utils/url-resolver.js +9 -0
  44. package/dist/src/utils/url-resolver.js.map +1 -0
  45. package/index.ts +29 -5
  46. package/package.json +32 -30
  47. package/src/commands/init.ts +86 -0
  48. package/src/commands/module/add.ts +169 -0
  49. package/src/commands/module/list.ts +69 -0
  50. package/src/commands/module/remove.ts +74 -0
  51. package/src/commands/module/update.ts +50 -0
  52. package/src/commands/run.ts +98 -0
  53. package/src/commands/setup.ts +74 -0
  54. package/src/utils/discovery.ts +134 -0
  55. package/src/utils/git.ts +65 -0
  56. package/src/utils/url-resolver.ts +57 -0
  57. package/test/e2e/lifecycle.e2e.test.ts +153 -0
  58. package/test/integration/commands/init.integration.test.ts +85 -0
  59. package/test/integration/commands/module.integration.test.ts +144 -0
  60. package/test/integration/commands/run.integration.test.ts +90 -0
  61. package/test/integration/utils/command-loading.integration.test.ts +80 -0
  62. package/test/unit/commands/init.test.ts +153 -0
  63. package/test/unit/commands/module/add.test.ts +262 -0
  64. package/test/unit/commands/module/list.test.ts +115 -0
  65. package/test/unit/commands/module/remove.test.ts +89 -0
  66. package/test/unit/commands/module/update.test.ts +91 -0
  67. package/test/unit/commands/run.test.ts +252 -0
  68. package/test/unit/commands/setup.test.ts +169 -0
  69. package/test/unit/utils/command-discovery.test.ts +176 -0
  70. package/test/unit/utils/git.test.ts +152 -0
  71. package/test/unit/utils/integration-helpers.test.ts +72 -0
  72. package/test/unit/utils/url-resolver.test.ts +39 -0
  73. package/test/utils/integration-helpers.ts +66 -0
  74. package/vitest.e2e.config.ts +0 -1
  75. package/dist/chunk-JDRAVUKK.js +0 -48
  76. package/dist/chunk-JDRAVUKK.js.map +0 -1
  77. package/dist/src/commands/admin/create-user.d.ts +0 -15
  78. package/dist/src/commands/admin/create-user.js +0 -49
  79. package/dist/src/commands/admin/create-user.js.map +0 -1
  80. package/dist/src/commands/branch/create.d.ts +0 -19
  81. package/dist/src/commands/branch/create.js +0 -59
  82. package/dist/src/commands/branch/create.js.map +0 -1
  83. package/dist/src/commands/branch/delete.d.ts +0 -15
  84. package/dist/src/commands/branch/delete.js +0 -50
  85. package/dist/src/commands/branch/delete.js.map +0 -1
  86. package/dist/src/commands/branch/get.d.ts +0 -15
  87. package/dist/src/commands/branch/get.js +0 -53
  88. package/dist/src/commands/branch/get.js.map +0 -1
  89. package/dist/src/commands/branch/list.d.ts +0 -15
  90. package/dist/src/commands/branch/list.js +0 -51
  91. package/dist/src/commands/branch/list.js.map +0 -1
  92. package/dist/src/commands/job/get.d.ts +0 -15
  93. package/dist/src/commands/job/get.js +0 -62
  94. package/dist/src/commands/job/get.js.map +0 -1
  95. package/dist/src/commands/job/list.d.ts +0 -15
  96. package/dist/src/commands/job/list.js +0 -57
  97. package/dist/src/commands/job/list.js.map +0 -1
  98. package/dist/src/commands/job/logs.d.ts +0 -15
  99. package/dist/src/commands/job/logs.js +0 -67
  100. package/dist/src/commands/job/logs.js.map +0 -1
  101. package/dist/src/commands/job/trigger.d.ts +0 -19
  102. package/dist/src/commands/job/trigger.js +0 -74
  103. package/dist/src/commands/job/trigger.js.map +0 -1
  104. package/dist/src/commands/login.js +0 -31
  105. package/dist/src/commands/login.js.map +0 -1
  106. package/dist/src/commands/project/create.d.ts +0 -24
  107. package/dist/src/commands/project/create.js +0 -63
  108. package/dist/src/commands/project/create.js.map +0 -1
  109. package/dist/src/commands/project/delete.d.ts +0 -20
  110. package/dist/src/commands/project/delete.js +0 -58
  111. package/dist/src/commands/project/delete.js.map +0 -1
  112. package/dist/src/commands/project/get.d.ts +0 -15
  113. package/dist/src/commands/project/get.js +0 -49
  114. package/dist/src/commands/project/get.js.map +0 -1
  115. package/dist/src/commands/project/list.d.ts +0 -15
  116. package/dist/src/commands/project/list.js +0 -45
  117. package/dist/src/commands/project/list.js.map +0 -1
  118. package/dist/src/commands/project/update.d.ts +0 -19
  119. package/dist/src/commands/project/update.js +0 -66
  120. package/dist/src/commands/project/update.js.map +0 -1
  121. package/dist/src/commands/team/create.d.ts +0 -19
  122. package/dist/src/commands/team/create.js +0 -45
  123. package/dist/src/commands/team/create.js.map +0 -1
  124. package/dist/src/commands/team/delete.d.ts +0 -20
  125. package/dist/src/commands/team/delete.js +0 -52
  126. package/dist/src/commands/team/delete.js.map +0 -1
  127. package/dist/src/commands/team/get.d.ts +0 -15
  128. package/dist/src/commands/team/get.js +0 -42
  129. package/dist/src/commands/team/get.js.map +0 -1
  130. package/dist/src/commands/team/list.d.ts +0 -8
  131. package/dist/src/commands/team/list.js +0 -30
  132. package/dist/src/commands/team/list.js.map +0 -1
  133. package/dist/src/commands/team/member/invite.d.ts +0 -20
  134. package/dist/src/commands/team/member/invite.js +0 -54
  135. package/dist/src/commands/team/member/invite.js.map +0 -1
  136. package/dist/src/commands/team/member/remove.d.ts +0 -15
  137. package/dist/src/commands/team/member/remove.js +0 -43
  138. package/dist/src/commands/team/member/remove.js.map +0 -1
  139. package/dist/src/commands/team/update.d.ts +0 -19
  140. package/dist/src/commands/team/update.js +0 -55
  141. package/dist/src/commands/team/update.js.map +0 -1
  142. package/dist/src/commands/token/generate.d.ts +0 -19
  143. package/dist/src/commands/token/generate.js +0 -48
  144. package/dist/src/commands/token/generate.js.map +0 -1
  145. package/dist/src/commands/token/list.d.ts +0 -8
  146. package/dist/src/commands/token/list.js +0 -31
  147. package/dist/src/commands/token/list.js.map +0 -1
  148. package/dist/src/commands/token/revoke.d.ts +0 -15
  149. package/dist/src/commands/token/revoke.js +0 -38
  150. package/dist/src/commands/token/revoke.js.map +0 -1
  151. package/dist/src/commands/whoami.d.ts +0 -8
  152. package/dist/src/commands/whoami.js +0 -26
  153. package/dist/src/commands/whoami.js.map +0 -1
  154. package/dist/src/utils/nexical-client.d.ts +0 -10
  155. package/dist/src/utils/nexical-client.js +0 -12
  156. package/src/commands/admin/create-user.ts +0 -46
  157. package/src/commands/branch/create.ts +0 -57
  158. package/src/commands/branch/delete.ts +0 -47
  159. package/src/commands/branch/get.ts +0 -50
  160. package/src/commands/branch/list.ts +0 -50
  161. package/src/commands/job/get.ts +0 -59
  162. package/src/commands/job/list.ts +0 -56
  163. package/src/commands/job/logs.ts +0 -67
  164. package/src/commands/job/trigger.ts +0 -73
  165. package/src/commands/login.ts +0 -31
  166. package/src/commands/project/create.ts +0 -61
  167. package/src/commands/project/delete.ts +0 -56
  168. package/src/commands/project/get.ts +0 -46
  169. package/src/commands/project/list.ts +0 -44
  170. package/src/commands/project/update.ts +0 -63
  171. package/src/commands/team/create.ts +0 -43
  172. package/src/commands/team/delete.ts +0 -50
  173. package/src/commands/team/get.ts +0 -39
  174. package/src/commands/team/list.ts +0 -26
  175. package/src/commands/team/member/invite.ts +0 -56
  176. package/src/commands/team/member/remove.ts +0 -40
  177. package/src/commands/team/update.ts +0 -53
  178. package/src/commands/token/generate.ts +0 -45
  179. package/src/commands/token/list.ts +0 -27
  180. package/src/commands/token/revoke.ts +0 -35
  181. package/src/commands/whoami.ts +0 -21
  182. package/src/utils/nexical-client.ts +0 -47
  183. package/test/e2e/auth.e2e.test.ts +0 -46
  184. package/test/e2e/job-workflow.e2e.test.ts +0 -33
  185. package/test/e2e/project-lifecycle.e2e.test.ts +0 -48
  186. package/test/e2e/setup.ts +0 -237
  187. package/test/e2e/utils.ts +0 -33
  188. package/test/integration/commands/admin/create-user.test.ts +0 -51
  189. package/test/integration/commands/branch/create.test.ts +0 -51
  190. package/test/integration/commands/branch/delete.test.ts +0 -43
  191. package/test/integration/commands/branch/get.test.ts +0 -49
  192. package/test/integration/commands/branch/list.test.ts +0 -47
  193. package/test/integration/commands/job/get.test.ts +0 -54
  194. package/test/integration/commands/job/list.test.ts +0 -47
  195. package/test/integration/commands/job/logs.test.ts +0 -47
  196. package/test/integration/commands/job/trigger.test.ts +0 -57
  197. package/test/integration/commands/login.test.ts +0 -62
  198. package/test/integration/commands/project/create.test.ts +0 -53
  199. package/test/integration/commands/project/delete.test.ts +0 -43
  200. package/test/integration/commands/project/get.test.ts +0 -51
  201. package/test/integration/commands/project/list.test.ts +0 -47
  202. package/test/integration/commands/project/update.test.ts +0 -53
  203. package/test/integration/commands/team/create.test.ts +0 -53
  204. package/test/integration/commands/team/delete.test.ts +0 -43
  205. package/test/integration/commands/team/get.test.ts +0 -50
  206. package/test/integration/commands/team/list.test.ts +0 -47
  207. package/test/integration/commands/team/member/invite.test.ts +0 -46
  208. package/test/integration/commands/team/member/remove.test.ts +0 -43
  209. package/test/integration/commands/team/update.test.ts +0 -50
  210. package/test/integration/commands/token/generate.test.ts +0 -51
  211. package/test/integration/commands/token/list.test.ts +0 -47
  212. package/test/integration/commands/token/revoke.test.ts +0 -43
  213. package/test/integration/commands/whoami.test.ts +0 -49
  214. package/test/unit/commands/admin/create-user.test.ts +0 -51
  215. package/test/unit/commands/branch/create.test.ts +0 -57
  216. package/test/unit/commands/branch/delete.test.ts +0 -49
  217. package/test/unit/commands/branch/get.test.ts +0 -67
  218. package/test/unit/commands/branch/list.test.ts +0 -62
  219. package/test/unit/commands/job/get.test.ts +0 -76
  220. package/test/unit/commands/job/list.test.ts +0 -62
  221. package/test/unit/commands/job/logs.test.ts +0 -60
  222. package/test/unit/commands/job/trigger.test.ts +0 -75
  223. package/test/unit/commands/login.test.ts +0 -64
  224. package/test/unit/commands/project/create.test.ts +0 -64
  225. package/test/unit/commands/project/delete.test.ts +0 -72
  226. package/test/unit/commands/project/get.test.ts +0 -73
  227. package/test/unit/commands/project/list.test.ts +0 -62
  228. package/test/unit/commands/project/update.test.ts +0 -58
  229. package/test/unit/commands/team/create.test.ts +0 -68
  230. package/test/unit/commands/team/delete.test.ts +0 -71
  231. package/test/unit/commands/team/get.test.ts +0 -70
  232. package/test/unit/commands/team/list.test.ts +0 -56
  233. package/test/unit/commands/team/member/invite.test.ts +0 -52
  234. package/test/unit/commands/team/member/remove.test.ts +0 -49
  235. package/test/unit/commands/team/update.test.ts +0 -63
  236. package/test/unit/commands/token/generate.test.ts +0 -65
  237. package/test/unit/commands/token/list.test.ts +0 -58
  238. package/test/unit/commands/token/revoke.test.ts +0 -49
  239. package/test/unit/commands/whoami.test.ts +0 -49
  240. package/test/unit/utils/nexical-client.test.ts +0 -113
  241. /package/dist/src/utils/{nexical-client.js.map → discovery.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1,14 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from "module"; const require = createRequire(import.meta.url);
3
+ import {
4
+ discoverCommandDirectories
5
+ } from "./chunk-OKXOCNXP.js";
6
+ import {
7
+ init_esm_shims
8
+ } from "./chunk-OYFWMYPG.js";
3
9
 
4
10
  // index.ts
5
- import { CLI } from "@nexical/cli-core";
11
+ init_esm_shims();
12
+ import { CLI, findProjectRoot } from "@nexical/cli-core";
6
13
  import { fileURLToPath } from "url";
7
14
 
8
15
  // package.json
9
16
  var package_default = {
10
17
  name: "@nexical/cli",
11
- version: "0.1.7",
18
+ version: "0.11.0",
12
19
  type: "module",
13
20
  bin: {
14
21
  nexical: "./dist/index.js"
@@ -25,7 +32,8 @@ var package_default = {
25
32
  },
26
33
  dependencies: {
27
34
  "@nexical/cli-core": "^0.1.12",
28
- "@nexical/sdk": "^0.4.2"
35
+ yaml: "^2.3.4",
36
+ "fast-glob": "^3.3.3"
29
37
  },
30
38
  devDependencies: {
31
39
  "@types/fs-extra": "^11.0.4",
@@ -34,6 +42,7 @@ var package_default = {
34
42
  execa: "^9.6.1",
35
43
  "fs-extra": "^11.3.2",
36
44
  tsup: "^8.0.1",
45
+ tsx: "^4.21.0",
37
46
  typescript: "^5.3.3",
38
47
  vitest: "^4.0.15"
39
48
  }
@@ -42,10 +51,28 @@ var package_default = {
42
51
  // index.ts
43
52
  import path from "path";
44
53
  var __dirname = path.dirname(fileURLToPath(import.meta.url));
54
+ var commandName = "nexical";
55
+ var projectRoot = await findProjectRoot(commandName, process.cwd()) || process.cwd();
56
+ var coreCommandsDir = path.resolve(__dirname, "./src/commands");
57
+ var additionalCommands = discoverCommandDirectories(projectRoot);
58
+ var filteredAdditional = additionalCommands.filter((dir) => {
59
+ if (dir === coreCommandsDir) return false;
60
+ if (coreCommandsDir.includes(path.join(path.sep, "dist", "src", "commands"))) {
61
+ const srcVersion = coreCommandsDir.replace(
62
+ path.join(path.sep, "dist", "src", "commands"),
63
+ path.join(path.sep, "src", "commands")
64
+ );
65
+ if (dir === srcVersion) return false;
66
+ }
67
+ return true;
68
+ });
45
69
  var app = new CLI({
46
70
  version: package_default.version,
47
- commandName: "nexical",
48
- searchDirectories: [path.resolve(__dirname, "./src/commands")]
71
+ commandName,
72
+ searchDirectories: [.../* @__PURE__ */ new Set([
73
+ coreCommandsDir,
74
+ ...filteredAdditional
75
+ ])]
49
76
  });
50
77
  app.start();
51
78
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../index.ts","../package.json"],"sourcesContent":["#!/usr/bin/env node\nimport { CLI } from \"@nexical/cli-core\";\nimport { fileURLToPath } from \"node:url\";\nimport pkg from './package.json';\nimport path from 'node:path';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst app = new CLI({\n version: pkg.version,\n commandName: \"nexical\",\n searchDirectories: [path.resolve(__dirname, \"./src/commands\")],\n});\napp.start();\n","{\n \"name\": \"@nexical/cli\",\n \"version\": \"0.1.7\",\n \"type\": \"module\",\n \"bin\": {\n \"nexical\": \"./dist/index.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"start\": \"node dist/index.js\",\n \"test\": \"npm run test:unit && npm run test:integration && npm run test:e2e\",\n \"test:unit\": \"vitest run --config vitest.config.ts --coverage\",\n \"test:integration\": \"vitest run --config vitest.integration.config.ts\",\n \"test:e2e\": \"npm run build && vitest run --config vitest.e2e.config.ts\",\n \"test:watch\": \"vitest\"\n },\n \"dependencies\": {\n \"@nexical/cli-core\": \"^0.1.12\",\n \"@nexical/sdk\": \"^0.4.2\"\n },\n \"devDependencies\": {\n \"@types/fs-extra\": \"^11.0.4\",\n \"@types/node\": \"^20.10.0\",\n \"@vitest/coverage-v8\": \"^4.0.15\",\n \"execa\": \"^9.6.1\",\n \"fs-extra\": \"^11.3.2\",\n \"tsup\": \"^8.0.1\",\n \"typescript\": \"^5.3.3\",\n \"vitest\": \"^4.0.15\"\n }\n}\n"],"mappings":";;;;AACA,SAAS,WAAW;AACpB,SAAS,qBAAqB;;;ACF9B;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,KAAO;AAAA,IACL,SAAW;AAAA,EACb;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,KAAO;AAAA,IACP,OAAS;AAAA,IACT,MAAQ;AAAA,IACR,aAAa;AAAA,IACb,oBAAoB;AAAA,IACpB,YAAY;AAAA,IACZ,cAAc;AAAA,EAChB;AAAA,EACA,cAAgB;AAAA,IACd,qBAAqB;AAAA,IACrB,gBAAgB;AAAA,EAClB;AAAA,EACA,iBAAmB;AAAA,IACjB,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,OAAS;AAAA,IACT,YAAY;AAAA,IACZ,MAAQ;AAAA,IACR,YAAc;AAAA,IACd,QAAU;AAAA,EACZ;AACF;;;AD3BA,OAAO,UAAU;AAEjB,IAAM,YAAY,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAE7D,IAAM,MAAM,IAAI,IAAI;AAAA,EAClB,SAAS,gBAAI;AAAA,EACb,aAAa;AAAA,EACb,mBAAmB,CAAC,KAAK,QAAQ,WAAW,gBAAgB,CAAC;AAC/D,CAAC;AACD,IAAI,MAAM;","names":[]}
1
+ {"version":3,"sources":["../index.ts","../package.json"],"sourcesContent":["#!/usr/bin/env node\nimport { CLI, findProjectRoot } from '@nexical/cli-core';\nimport { fileURLToPath } from 'node:url';\nimport { discoverCommandDirectories } from './src/utils/discovery.js';\nimport pkg from './package.json';\nimport path from 'node:path';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nconst commandName = 'nexical';\nconst projectRoot = await findProjectRoot(commandName, process.cwd()) || process.cwd();\nconst coreCommandsDir = path.resolve(__dirname, './src/commands');\nconst additionalCommands = discoverCommandDirectories(projectRoot);\n\n// Filter out the source version of core commands if we are running from dist\nconst filteredAdditional = additionalCommands.filter(dir => {\n if (dir === coreCommandsDir) return false;\n\n // Handle the case where we are running from dist/ and it finds src/commands in projectRoot\n if (coreCommandsDir.includes(path.join(path.sep, 'dist', 'src', 'commands'))) {\n const srcVersion = coreCommandsDir.replace(\n path.join(path.sep, 'dist', 'src', 'commands'),\n path.join(path.sep, 'src', 'commands')\n );\n if (dir === srcVersion) return false;\n }\n return true;\n});\n\nconst app = new CLI({\n version: pkg.version,\n commandName: commandName,\n searchDirectories: [...new Set([\n coreCommandsDir,\n ...filteredAdditional\n ])]\n});\napp.start();\n","{\n \"name\": \"@nexical/cli\",\n \"version\": \"0.11.0\",\n \"type\": \"module\",\n \"bin\": {\n \"nexical\": \"./dist/index.js\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"start\": \"node dist/index.js\",\n \"test\": \"npm run test:unit && npm run test:integration && npm run test:e2e\",\n \"test:unit\": \"vitest run --config vitest.config.ts --coverage\",\n \"test:integration\": \"vitest run --config vitest.integration.config.ts\",\n \"test:e2e\": \"npm run build && vitest run --config vitest.e2e.config.ts\",\n \"test:watch\": \"vitest\"\n },\n \"dependencies\": {\n \"@nexical/cli-core\": \"^0.1.12\",\n \"yaml\": \"^2.3.4\",\n \"fast-glob\": \"^3.3.3\"\n },\n \"devDependencies\": {\n \"@types/fs-extra\": \"^11.0.4\",\n \"@types/node\": \"^20.10.0\",\n \"@vitest/coverage-v8\": \"^4.0.15\",\n \"execa\": \"^9.6.1\",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K,KAAK,QAAQ,OAAO,UAAU;AAAA,MAC7C,KAAK,KAAK,KAAK,KAAK,OAAO,UAAU;AAAA,IACzC;AACA,QAAI,QAAQ,WAAY,QAAO;AAAA,EACnC;AACA,SAAO;AACX,CAAC;AAED,IAAM,MAAM,IAAI,IAAI;AAAA,EAChB,SAAS,gBAAI;AAAA,EACb;AAAA,EACA,mBAAmB,CAAC,GAAG,oBAAI,IAAI;AAAA,IAC3B;AAAA,IACA,GAAG;AAAA,EACP,CAAC,CAAC;AACN,CAAC;AACD,IAAI,MAAM;","names":[]}
@@ -0,0 +1,11 @@
1
+ import { BaseCommand, CommandDefinition } from '@nexical/cli-core';
2
+
3
+ declare class InitCommand extends BaseCommand {
4
+ static usage: string;
5
+ static description: string;
6
+ static requiresProject: boolean;
7
+ static args: CommandDefinition;
8
+ run(options: any): Promise<void>;
9
+ }
10
+
11
+ export { InitCommand as default };
@@ -0,0 +1,89 @@
1
+ import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_lib
4
+ } from "../../chunk-LZ3YQWAR.js";
5
+ import {
6
+ addAll,
7
+ clone,
8
+ commit,
9
+ renameRemote,
10
+ updateSubmodules
11
+ } from "../../chunk-WKERTCM6.js";
12
+ import {
13
+ resolveGitUrl
14
+ } from "../../chunk-JYASTIIW.js";
15
+ import {
16
+ __toESM,
17
+ init_esm_shims
18
+ } from "../../chunk-OYFWMYPG.js";
19
+
20
+ // src/commands/init.ts
21
+ init_esm_shims();
22
+ import { BaseCommand, logger, runCommand } from "@nexical/cli-core";
23
+ var import_fs_extra = __toESM(require_lib(), 1);
24
+ import path from "path";
25
+ var InitCommand = class extends BaseCommand {
26
+ static usage = "init";
27
+ static description = "Initialize a new Nexical project.";
28
+ static requiresProject = false;
29
+ static args = {
30
+ args: [
31
+ { name: "directory", required: true, description: "Directory to initialize the project in" }
32
+ ],
33
+ options: [
34
+ {
35
+ name: "--repo <url>",
36
+ description: "Starter repository URL (supports gh@owner/repo syntax)",
37
+ default: "gh@nexical/app-starter"
38
+ }
39
+ ]
40
+ };
41
+ async run(options) {
42
+ const directory = options.directory;
43
+ const targetPath = path.resolve(process.cwd(), directory);
44
+ let repoUrl = resolveGitUrl(options.repo);
45
+ logger.debug("Init options:", { directory, targetPath, repoUrl });
46
+ this.info(`Initializing project in: ${targetPath}`);
47
+ this.info(`Using starter repository: ${repoUrl}`);
48
+ if (await import_fs_extra.default.pathExists(targetPath)) {
49
+ if ((await import_fs_extra.default.readdir(targetPath)).length > 0) {
50
+ this.error(`Directory ${directory} is not empty.`);
51
+ process.exit(1);
52
+ }
53
+ } else {
54
+ await import_fs_extra.default.mkdir(targetPath, { recursive: true });
55
+ }
56
+ try {
57
+ this.info("Cloning starter repository...");
58
+ await clone(repoUrl, targetPath, { recursive: true });
59
+ this.info("Updating submodules...");
60
+ await updateSubmodules(targetPath);
61
+ this.info("Installing dependencies...");
62
+ await runCommand("npm install", targetPath);
63
+ this.info("Setting up upstream remote...");
64
+ await renameRemote("origin", "upstream", targetPath);
65
+ this.info("Running project setup...");
66
+ await runCommand("npm run setup", targetPath);
67
+ const configPath = path.join(targetPath, "nexical.yaml");
68
+ if (!await import_fs_extra.default.pathExists(configPath)) {
69
+ this.info("Creating default nexical.yaml...");
70
+ await import_fs_extra.default.writeFile(configPath, "name: " + path.basename(targetPath) + "\nmodules: []\n");
71
+ }
72
+ const versionPath = path.join(targetPath, "VERSION");
73
+ if (!await import_fs_extra.default.pathExists(versionPath)) {
74
+ this.info("Creating VERSION file with 0.1.0...");
75
+ await import_fs_extra.default.writeFile(versionPath, "0.1.0");
76
+ }
77
+ await addAll(targetPath);
78
+ await commit("Initial site commit", targetPath);
79
+ this.success(`Project initialized successfully in ${directory}!`);
80
+ } catch (error) {
81
+ this.error(`Failed to initialize project: ${error.message}`);
82
+ process.exit(1);
83
+ }
84
+ }
85
+ };
86
+ export {
87
+ InitCommand as default
88
+ };
89
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/commands/init.ts"],"sourcesContent":["import { type CommandDefinition, BaseCommand, logger, runCommand } from '@nexical/cli-core';\nimport * as git from '../utils/git.js';\nimport { resolveGitUrl } from '../utils/url-resolver.js';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nexport default class InitCommand extends BaseCommand {\n static usage = 'init';\n static description = 'Initialize a new Nexical project.';\n static requiresProject = false;\n\n static args: CommandDefinition = {\n args: [\n { name: 'directory', required: true, description: 'Directory to initialize the project in' }\n ],\n options: [\n {\n name: '--repo <url>',\n description: 'Starter repository URL (supports gh@owner/repo syntax)',\n default: 'gh@nexical/app-starter'\n }\n ]\n };\n\n async run(options: any) {\n const directory = options.directory;\n const targetPath = path.resolve(process.cwd(), directory);\n let repoUrl = resolveGitUrl(options.repo);\n\n logger.debug('Init options:', { directory, targetPath, repoUrl });\n\n this.info(`Initializing project in: ${targetPath}`);\n this.info(`Using starter repository: ${repoUrl}`);\n\n if (await fs.pathExists(targetPath)) {\n if ((await fs.readdir(targetPath)).length > 0) {\n this.error(`Directory ${directory} is not empty.`);\n process.exit(1);\n }\n } else {\n await fs.mkdir(targetPath, { recursive: true });\n }\n\n try {\n this.info('Cloning starter repository...');\n await git.clone(repoUrl, targetPath, { recursive: true });\n\n this.info('Updating submodules...');\n await git.updateSubmodules(targetPath);\n\n this.info('Installing dependencies...');\n await runCommand('npm install', targetPath);\n\n this.info('Setting up upstream remote...');\n await git.renameRemote('origin', 'upstream', targetPath);\n\n // Run setup script\n this.info('Running project setup...');\n await runCommand('npm run setup', targetPath);\n\n // Check for nexical.yaml, if not present create a default one\n const configPath = path.join(targetPath, 'nexical.yaml');\n if (!await fs.pathExists(configPath)) {\n this.info('Creating default nexical.yaml...');\n await fs.writeFile(configPath, 'name: ' + path.basename(targetPath) + '\\nmodules: []\\n');\n }\n\n // Create VERSION file\n const versionPath = path.join(targetPath, 'VERSION');\n // Check if version file exists, if not create it\n if (!await fs.pathExists(versionPath)) {\n this.info('Creating VERSION file with 0.1.0...');\n await fs.writeFile(versionPath, '0.1.0');\n }\n\n await git.addAll(targetPath);\n await git.commit('Initial site commit', targetPath);\n\n this.success(`Project initialized successfully in ${directory}!`);\n\n } catch (error: any) {\n this.error(`Failed to initialize project: ${error.message}`);\n process.exit(1);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA,SAAiC,aAAa,QAAQ,kBAAkB;AAGxE,sBAAe;AACf,OAAO,UAAU;AAEjB,IAAqB,cAArB,cAAyC,YAAY;AAAA,EACjD,OAAO,QAAQ;AAAA,EACf,OAAO,cAAc;AAAA,EACrB,OAAO,kBAAkB;AAAA,EAEzB,OAAO,OAA0B;AAAA,IAC7B,MAAM;AAAA,MACF,EAAE,MAAM,aAAa,UAAU,MAAM,aAAa,yCAAyC;AAAA,IAC/F;AAAA,IACA,SAAS;AAAA,MACL;AAAA,QACI,MAAM;AAAA,QACN,aAAa;AAAA,QACb,SAAS;AAAA,MACb;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,MAAM,IAAI,SAAc;AACpB,UAAM,YAAY,QAAQ;AAC1B,UAAM,aAAa,KAAK,QAAQ,QAAQ,IAAI,GAAG,SAAS;AACxD,QAAI,UAAU,cAAc,QAAQ,IAAI;AAExC,WAAO,MAAM,iBAAiB,EAAE,WAAW,YAAY,QAAQ,CAAC;AAEhE,SAAK,KAAK,4BAA4B,UAAU,EAAE;AAClD,SAAK,KAAK,6BAA6B,OAAO,EAAE;AAEhD,QAAI,MAAM,gBAAAA,QAAG,WAAW,UAAU,GAAG;AACjC,WAAK,MAAM,gBAAAA,QAAG,QAAQ,UAAU,GAAG,SAAS,GAAG;AAC3C,aAAK,MAAM,aAAa,SAAS,gBAAgB;AACjD,gBAAQ,KAAK,CAAC;AAAA,MAClB;AAAA,IACJ,OAAO;AACH,YAAM,gBAAAA,QAAG,MAAM,YAAY,EAAE,WAAW,KAAK,CAAC;AAAA,IAClD;AAEA,QAAI;AACA,WAAK,KAAK,+BAA+B;AACzC,YAAU,MAAM,SAAS,YAAY,EAAE,WAAW,KAAK,CAAC;AAExD,WAAK,KAAK,wBAAwB;AAClC,YAAU,iBAAiB,UAAU;AAErC,WAAK,KAAK,4BAA4B;AACtC,YAAM,WAAW,eAAe,UAAU;AAE1C,WAAK,KAAK,+BAA+B;AACzC,YAAU,aAAa,UAAU,YAAY,UAAU;AAGvD,WAAK,KAAK,0BAA0B;AACpC,YAAM,WAAW,iBAAiB,UAAU;AAG5C,YAAM,aAAa,KAAK,KAAK,YAAY,cAAc;AACvD,UAAI,CAAC,MAAM,gBAAAA,QAAG,WAAW,UAAU,GAAG;AAClC,aAAK,KAAK,kCAAkC;AAC5C,cAAM,gBAAAA,QAAG,UAAU,YAAY,WAAW,KAAK,SAAS,UAAU,IAAI,iBAAiB;AAAA,MAC3F;AAGA,YAAM,cAAc,KAAK,KAAK,YAAY,SAAS;AAEnD,UAAI,CAAC,MAAM,gBAAAA,QAAG,WAAW,WAAW,GAAG;AACnC,aAAK,KAAK,qCAAqC;AAC/C,cAAM,gBAAAA,QAAG,UAAU,aAAa,OAAO;AAAA,MAC3C;AAEA,YAAU,OAAO,UAAU;AAC3B,YAAU,OAAO,uBAAuB,UAAU;AAElD,WAAK,QAAQ,uCAAuC,SAAS,GAAG;AAAA,IAEpE,SAAS,OAAY;AACjB,WAAK,MAAM,iCAAiC,MAAM,OAAO,EAAE;AAC3D,cAAQ,KAAK,CAAC;AAAA,IAClB;AAAA,EACJ;AACJ;","names":["fs"]}
@@ -0,0 +1,14 @@
1
+ import { BaseCommand, CommandDefinition } from '@nexical/cli-core';
2
+
3
+ declare class ModuleAddCommand extends BaseCommand {
4
+ static usage: string;
5
+ static description: string;
6
+ static requiresProject: boolean;
7
+ static args: CommandDefinition;
8
+ private visited;
9
+ run(options: any): Promise<void>;
10
+ private installModule;
11
+ private addToConfig;
12
+ }
13
+
14
+ export { ModuleAddCommand as default };
@@ -0,0 +1,136 @@
1
+ import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_lib
4
+ } from "../../../chunk-LZ3YQWAR.js";
5
+ import {
6
+ clone,
7
+ getRemoteUrl
8
+ } from "../../../chunk-WKERTCM6.js";
9
+ import {
10
+ resolveGitUrl
11
+ } from "../../../chunk-JYASTIIW.js";
12
+ import {
13
+ __toESM,
14
+ init_esm_shims
15
+ } from "../../../chunk-OYFWMYPG.js";
16
+
17
+ // src/commands/module/add.ts
18
+ init_esm_shims();
19
+ var import_fs_extra = __toESM(require_lib(), 1);
20
+ import { BaseCommand, logger, runCommand } from "@nexical/cli-core";
21
+ import path from "path";
22
+ import YAML from "yaml";
23
+ var ModuleAddCommand = class extends BaseCommand {
24
+ static usage = "module add <url>";
25
+ static description = "Add a module and its dependencies as git submodules.";
26
+ static requiresProject = true;
27
+ static args = {
28
+ args: [
29
+ { name: "url", required: true, description: "Git repository URL or gh@org/repo" }
30
+ ]
31
+ };
32
+ visited = /* @__PURE__ */ new Set();
33
+ async run(options) {
34
+ const projectRoot = this.projectRoot;
35
+ let { url } = options;
36
+ if (!url) {
37
+ this.error("Please specify a repository URL.");
38
+ return;
39
+ }
40
+ try {
41
+ await this.installModule(url);
42
+ this.info("Syncing workspace dependencies...");
43
+ await runCommand("npm install", projectRoot);
44
+ this.success("All modules installed successfully.");
45
+ } catch (e) {
46
+ this.error(`Failed to add module: ${e.message}`);
47
+ }
48
+ }
49
+ async installModule(url) {
50
+ const projectRoot = this.projectRoot;
51
+ url = resolveGitUrl(url);
52
+ const [repoUrl, subPath] = url.split(".git//");
53
+ const cleanUrl = subPath ? repoUrl + ".git" : url;
54
+ if (this.visited.has(cleanUrl)) {
55
+ logger.debug(`Already visited ${cleanUrl}, skipping.`);
56
+ return;
57
+ }
58
+ this.visited.add(cleanUrl);
59
+ this.info(`Inspecting ${cleanUrl}...`);
60
+ const stagingDir = path.resolve(projectRoot, ".nexical", "cache", `staging-${Date.now()}-${Math.random().toString(36).substring(7)}`);
61
+ let moduleName = "";
62
+ let dependencies = [];
63
+ try {
64
+ await import_fs_extra.default.ensureDir(stagingDir);
65
+ await clone(cleanUrl, stagingDir, { depth: 1 });
66
+ const searchPath = subPath ? path.join(stagingDir, subPath) : stagingDir;
67
+ const moduleYamlPath = path.join(searchPath, "module.yaml");
68
+ const moduleYmlPath = path.join(searchPath, "module.yml");
69
+ let configPath = "";
70
+ if (await import_fs_extra.default.pathExists(moduleYamlPath)) configPath = moduleYamlPath;
71
+ else if (await import_fs_extra.default.pathExists(moduleYmlPath)) configPath = moduleYmlPath;
72
+ else {
73
+ throw new Error(`No module.yaml found in ${cleanUrl}${subPath ? "//" + subPath : ""}`);
74
+ }
75
+ const configContent = await import_fs_extra.default.readFile(configPath, "utf8");
76
+ const config = YAML.parse(configContent);
77
+ if (!config.name) {
78
+ throw new Error(`Module at ${url} is missing 'name' in module.yaml`);
79
+ }
80
+ moduleName = config.name;
81
+ dependencies = config.dependencies || [];
82
+ if (dependencies && !Array.isArray(dependencies)) {
83
+ dependencies = Object.keys(dependencies);
84
+ }
85
+ } catch (e) {
86
+ throw e;
87
+ } finally {
88
+ await import_fs_extra.default.remove(stagingDir);
89
+ }
90
+ const targetDir = path.join(projectRoot, "modules", moduleName);
91
+ const relativeTargetDir = path.relative(projectRoot, targetDir);
92
+ if (await import_fs_extra.default.pathExists(targetDir)) {
93
+ const existingRemote = await getRemoteUrl(targetDir);
94
+ const normExisting = existingRemote.replace(/\.git$/, "");
95
+ const normNew = cleanUrl.replace(/\.git$/, "");
96
+ if (normExisting !== normNew && existingRemote !== "") {
97
+ throw new Error(`Dependency Conflict! Module '${moduleName}' exists but remote '${existingRemote}' does not match '${cleanUrl}'.`);
98
+ }
99
+ this.info(`Module ${moduleName} already installed.`);
100
+ } else {
101
+ this.info(`Installing ${moduleName} to ${relativeTargetDir}...`);
102
+ await runCommand(`git submodule add ${cleanUrl} ${relativeTargetDir}`, projectRoot);
103
+ }
104
+ await this.addToConfig(moduleName);
105
+ if (dependencies.length > 0) {
106
+ this.info(`Resolving ${dependencies.length} dependencies for ${moduleName}...`);
107
+ for (const depUrl of dependencies) {
108
+ await this.installModule(depUrl);
109
+ }
110
+ }
111
+ }
112
+ async addToConfig(moduleName) {
113
+ const projectRoot = this.projectRoot;
114
+ const configPath = path.join(projectRoot, "nexical.yaml");
115
+ if (!await import_fs_extra.default.pathExists(configPath)) {
116
+ logger.warn("nexical.yaml not found, skipping module list update.");
117
+ return;
118
+ }
119
+ try {
120
+ const content = await import_fs_extra.default.readFile(configPath, "utf8");
121
+ let config = YAML.parse(content) || {};
122
+ if (!config.modules) config.modules = [];
123
+ if (!config.modules.includes(moduleName)) {
124
+ config.modules.push(moduleName);
125
+ await import_fs_extra.default.writeFile(configPath, YAML.stringify(config));
126
+ logger.debug(`Added ${moduleName} to nexical.yaml modules list.`);
127
+ }
128
+ } catch (e) {
129
+ logger.warn(`Failed to update nexical.yaml: ${e.message}`);
130
+ }
131
+ }
132
+ };
133
+ export {
134
+ ModuleAddCommand as default
135
+ };
136
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/module/add.ts"],"sourcesContent":["import { type CommandDefinition, BaseCommand, logger, runCommand } from '@nexical/cli-core';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport { clone, getRemoteUrl } from '../../utils/git.js';\nimport { resolveGitUrl } from '../../utils/url-resolver.js';\nimport YAML from 'yaml';\n\nexport default class ModuleAddCommand extends BaseCommand {\n static usage = 'module add <url>';\n static description = 'Add a module and its dependencies as git submodules.';\n static requiresProject = true;\n\n static args: CommandDefinition = {\n args: [\n { name: 'url', required: true, description: 'Git repository URL or gh@org/repo' }\n ]\n };\n\n private visited = new Set<string>();\n\n async run(options: any) {\n const projectRoot = this.projectRoot as string;\n let { url } = options;\n\n if (!url) {\n this.error('Please specify a repository URL.');\n return;\n }\n\n try {\n await this.installModule(url);\n\n this.info('Syncing workspace dependencies...');\n await runCommand('npm install', projectRoot);\n\n this.success('All modules installed successfully.');\n } catch (e: any) {\n this.error(`Failed to add module: ${e.message}`);\n }\n }\n\n private async installModule(url: string) {\n const projectRoot = this.projectRoot as string;\n\n // Resolve URL using utility\n url = resolveGitUrl(url);\n\n const [repoUrl, subPath] = url.split('.git//');\n const cleanUrl = subPath ? repoUrl + '.git' : url;\n\n if (this.visited.has(cleanUrl)) {\n logger.debug(`Already visited ${cleanUrl}, skipping.`);\n return;\n }\n this.visited.add(cleanUrl);\n\n this.info(`Inspecting ${cleanUrl}...`);\n\n // Stage 1: Inspect (Temp Clone)\n const stagingDir = path.resolve(projectRoot!, '.nexical', 'cache', `staging-${Date.now()}-${Math.random().toString(36).substring(7)}`);\n let moduleName = '';\n let dependencies: string[] = [];\n\n try {\n await fs.ensureDir(stagingDir);\n\n // Shallow clone to inspect\n await clone(cleanUrl, stagingDir, { depth: 1 });\n\n // Read module.yaml\n const searchPath = subPath ? path.join(stagingDir, subPath) : stagingDir;\n const moduleYamlPath = path.join(searchPath, 'module.yaml');\n const moduleYmlPath = path.join(searchPath, 'module.yml');\n\n let configPath = '';\n if (await fs.pathExists(moduleYamlPath)) configPath = moduleYamlPath;\n else if (await fs.pathExists(moduleYmlPath)) configPath = moduleYmlPath;\n else {\n throw new Error(`No module.yaml found in ${cleanUrl}${subPath ? '//' + subPath : ''}`);\n }\n\n const configContent = await fs.readFile(configPath, 'utf8');\n const config = YAML.parse(configContent);\n\n if (!config.name) {\n throw new Error(`Module at ${url} is missing 'name' in module.yaml`);\n }\n moduleName = config.name;\n dependencies = config.dependencies || [];\n\n // Normalize dependencies to array if object (though spec says list of strings, defensiveness is good)\n if (dependencies && !Array.isArray(dependencies)) {\n dependencies = Object.keys(dependencies);\n }\n\n } catch (e: any) { // Catching as 'any' for error message access\n throw e;\n } finally {\n // Cleanup staging always\n await fs.remove(stagingDir);\n }\n\n // Stage 2: Conflict Detection\n const targetDir = path.join(projectRoot!, 'modules', moduleName);\n const relativeTargetDir = path.relative(projectRoot!, targetDir);\n\n if (await fs.pathExists(targetDir)) {\n // Check origin\n const existingRemote = await getRemoteUrl(targetDir);\n // We compare cleanUrl (the repo root).\n // normalize both\n const normExisting = existingRemote.replace(/\\.git$/, '');\n const normNew = cleanUrl.replace(/\\.git$/, '');\n\n if (normExisting !== normNew && existingRemote !== '') {\n throw new Error(`Dependency Conflict! Module '${moduleName}' exists but remote '${existingRemote}' does not match '${cleanUrl}'.`);\n }\n\n this.info(`Module ${moduleName} already installed.`);\n // Proceed to recurse, but skip add\n } else {\n // Stage 3: Submodule Add\n this.info(`Installing ${moduleName} to ${relativeTargetDir}...`);\n // We install the ROOT repo.\n // IMPORTANT: If subPath exists, \"Identity is Internal\" means we name the folder `moduleName`.\n // But the CONTENT will be the whole repo.\n // If the user meant to only have the subdir, we can't do that with submodule add easily without manual git plumbing.\n // Given instructions, I will proceed with submodule add of root repo to target dir.\n await runCommand(`git submodule add ${cleanUrl} ${relativeTargetDir}`, projectRoot!);\n }\n\n // Update nexical.yaml\n await this.addToConfig(moduleName);\n\n // Stage 4: Recurse\n if (dependencies.length > 0) {\n this.info(`Resolving ${dependencies.length} dependencies for ${moduleName}...`);\n for (const depUrl of dependencies) {\n await this.installModule(depUrl);\n }\n }\n }\n\n private async addToConfig(moduleName: string) {\n const projectRoot = this.projectRoot as string;\n const configPath = path.join(projectRoot, 'nexical.yaml');\n\n if (!await fs.pathExists(configPath)) {\n // Not strictly required to exist for all operations, but good to have if we are tracking modules.\n logger.warn('nexical.yaml not found, skipping module list update.');\n return;\n }\n\n try {\n const content = await fs.readFile(configPath, 'utf8');\n let config = YAML.parse(content) || {};\n\n if (!config.modules) config.modules = [];\n\n if (!config.modules.includes(moduleName)) {\n config.modules.push(moduleName);\n await fs.writeFile(configPath, YAML.stringify(config));\n logger.debug(`Added ${moduleName} to nexical.yaml modules list.`);\n }\n } catch (e: any) {\n logger.warn(`Failed to update nexical.yaml: ${e.message}`);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA,sBAAe;AADf,SAAiC,aAAa,QAAQ,k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 static usage: string;
5
+ static description: string;
6
+ static requiresProject: boolean;
7
+ run(): Promise<void>;
8
+ }
9
+
10
+ export { ModuleListCommand as default };
@@ -0,0 +1,73 @@
1
+ import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_lib
4
+ } from "../../../chunk-LZ3YQWAR.js";
5
+ import {
6
+ __toESM,
7
+ init_esm_shims
8
+ } from "../../../chunk-OYFWMYPG.js";
9
+
10
+ // src/commands/module/list.ts
11
+ init_esm_shims();
12
+ var import_fs_extra = __toESM(require_lib(), 1);
13
+ import { BaseCommand, logger } from "@nexical/cli-core";
14
+ import path from "path";
15
+ import YAML from "yaml";
16
+ var ModuleListCommand = class extends BaseCommand {
17
+ static usage = "module list";
18
+ static description = "List installed modules.";
19
+ static requiresProject = true;
20
+ async run() {
21
+ const projectRoot = this.projectRoot;
22
+ const modulesDir = path.resolve(projectRoot, "modules");
23
+ logger.debug(`Scanning for modules in: ${modulesDir}`);
24
+ if (!await import_fs_extra.default.pathExists(modulesDir)) {
25
+ this.info("No modules installed (modules directory missing).");
26
+ return;
27
+ }
28
+ try {
29
+ const modules = await import_fs_extra.default.readdir(modulesDir);
30
+ const validModules = [];
31
+ for (const moduleName of modules) {
32
+ const modulePath = path.join(modulesDir, moduleName);
33
+ if ((await import_fs_extra.default.stat(modulePath)).isDirectory()) {
34
+ let version = "unknown";
35
+ let description = "";
36
+ const pkgJsonPath = path.join(modulePath, "package.json");
37
+ const moduleYamlPath = path.join(modulePath, "module.yaml");
38
+ const moduleYmlPath = path.join(modulePath, "module.yml");
39
+ let pkg = {};
40
+ let modConfig = {};
41
+ if (await import_fs_extra.default.pathExists(pkgJsonPath)) {
42
+ try {
43
+ pkg = await import_fs_extra.default.readJson(pkgJsonPath);
44
+ } catch (e) {
45
+ }
46
+ }
47
+ if (await import_fs_extra.default.pathExists(moduleYamlPath) || await import_fs_extra.default.pathExists(moduleYmlPath)) {
48
+ try {
49
+ const configPath = await import_fs_extra.default.pathExists(moduleYamlPath) ? moduleYamlPath : moduleYmlPath;
50
+ const content = await import_fs_extra.default.readFile(configPath, "utf8");
51
+ modConfig = YAML.parse(content) || {};
52
+ } catch (e) {
53
+ }
54
+ }
55
+ version = pkg.version || "unknown";
56
+ description = modConfig.description || pkg.description || "";
57
+ validModules.push({ name: moduleName, version, description });
58
+ }
59
+ }
60
+ if (validModules.length === 0) {
61
+ this.info("No modules installed.");
62
+ } else {
63
+ console.table(validModules);
64
+ }
65
+ } catch (error) {
66
+ this.error(`Failed to list modules: ${error.message}`);
67
+ }
68
+ }
69
+ };
70
+ export {
71
+ ModuleListCommand as default
72
+ };
73
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/module/list.ts"],"sourcesContent":["import { BaseCommand, logger } from '@nexical/cli-core';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport YAML from 'yaml';\n\nexport default class ModuleListCommand extends BaseCommand {\n static usage = 'module list';\n static description = 'List installed modules.';\n static requiresProject = true;\n\n async run() {\n const projectRoot = this.projectRoot as string;\n const modulesDir = path.resolve(projectRoot, 'modules');\n logger.debug(`Scanning for modules in: ${modulesDir}`);\n\n if (!(await fs.pathExists(modulesDir))) {\n this.info('No modules installed (modules directory missing).');\n return;\n }\n\n try {\n const modules = await fs.readdir(modulesDir);\n const validModules: { name: string; version: string; description: string }[] = [];\n\n for (const moduleName of modules) {\n const modulePath = path.join(modulesDir, moduleName);\n if ((await fs.stat(modulePath)).isDirectory()) {\n let version = 'unknown';\n let description = '';\n\n const pkgJsonPath = path.join(modulePath, 'package.json');\n const moduleYamlPath = path.join(modulePath, 'module.yaml');\n const moduleYmlPath = path.join(modulePath, 'module.yml');\n\n let pkg: any = {};\n let modConfig: any = {};\n\n if (await fs.pathExists(pkgJsonPath)) {\n try {\n pkg = await fs.readJson(pkgJsonPath);\n } catch (e) { /* ignore */ }\n }\n\n if (await fs.pathExists(moduleYamlPath) || await fs.pathExists(moduleYmlPath)) {\n try {\n const configPath = await fs.pathExists(moduleYamlPath) ? moduleYamlPath : moduleYmlPath;\n const content = await fs.readFile(configPath, 'utf8');\n modConfig = YAML.parse(content) || {};\n } catch (e) { /* ignore */ }\n }\n\n version = pkg.version || 'unknown';\n description = modConfig.description || pkg.description || '';\n // Optionally use display name from module.yaml if present, but strictly list is usually dir name.\n // Let's stick to dir name for \"name\" column, but description from module.yaml is good.\n validModules.push({ name: moduleName, version, description });\n }\n }\n\n if (validModules.length === 0) {\n this.info('No modules installed.');\n } else {\n console.table(validModules);\n }\n } catch (error: any) {\n this.error(`Failed to list modules: ${error.message}`);\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA,sBAAe;AADf,SAAS,aAAa,cAAc;AAEpC,OAAO,UAAU;AACjB,OAAO,UAAU;AAEjB,IAAqB,oBAArB,cAA+C,YAAY;AAAA,EACvD,OAAO,QAAQ;AAAA,EACf,OAAO,cAAc;AAAA,EACrB,OAAO,kBAAkB;AAAA,EAEzB,MAAM,MAAM;AACR,UAAM,cAAc,KAAK;AACzB,UAAM,aAAa,KAAK,QAAQ,aAAa,SAAS;AACtD,WAAO,MAAM,4BAA4B,UAAU,EAAE;AAErD,QAAI,CAAE,MAAM,gBAAAA,QAAG,WAAW,UAAU,GAAI;AACpC,WAAK,KAAK,mDAAmD;AAC7D;AAAA,IACJ;AAEA,QAAI;AACA,YAAM,UAAU,MAAM,gBAAAA,QAAG,QAAQ,UAAU;AAC3C,YAAM,eAAyE,CAAC;AAEhF,iBAAW,cAAc,SAAS;AAC9B,cAAM,aAAa,KAAK,KAAK,YAAY,UAAU;AACnD,aAAK,MAAM,gBAAAA,QAAG,KAAK,UAAU,GAAG,YAAY,GAAG;AAC3C,cAAI,UAAU;AACd,cAAI,cAAc;AAElB,gBAAM,cAAc,KAAK,KAAK,YAAY,cAAc;AACxD,gBAAM,iBAAiB,KAAK,KAAK,YAAY,aAAa;AAC1D,gBAAM,gBAAgB,KAAK,KAAK,YAAY,YAAY;AAExD,cAAI,MAAW,CAAC;AAChB,cAAI,YAAiB,CAAC;AAEtB,cAAI,MAAM,gBAAAA,QAAG,WAAW,WAAW,GAAG;AAClC,gBAAI;AACA,oBAAM,MAAM,gBAAAA,QAAG,SAAS,WAAW;AAAA,YACvC,SAAS,GAAG;AAAA,YAAe;AAAA,UAC/B;AAEA,cAAI,MAAM,gBAAAA,QAAG,WAAW,cAAc,KAAK,MAAM,gBAAAA,QAAG,WAAW,aAAa,GAAG;AAC3E,gBAAI;AACA,oBAAM,aAAa,MAAM,gBAAAA,QAAG,WAAW,cAAc,IAAI,iBAAiB;AAC1E,oBAAM,UAAU,MAAM,gBAAAA,QAAG,SAAS,YAAY,MAAM;AACpD,0BAAY,KAAK,MAAM,OAAO,KAAK,CAAC;AAAA,YACxC,SAAS,GAAG;AAAA,YAAe;AAAA,UAC/B;AAEA,oBAAU,IAAI,WAAW;AACzB,wBAAc,UAAU,eAAe,IAAI,eAAe;AAG1D,uBAAa,KAAK,EAAE,MAAM,YAAY,SAAS,YAAY,CAAC;AAAA,QAChE;AAAA,MACJ;AAEA,UAAI,aAAa,WAAW,GAAG;AAC3B,aAAK,KAAK,uBAAuB;AAAA,MACrC,OAAO;AACH,gBAAQ,MAAM,YAAY;AAAA,MAC9B;AAAA,IACJ,SAAS,OAAY;AACjB,WAAK,MAAM,2BAA2B,MAAM,OAAO,EAAE;AAAA,IACzD;AAAA,EACJ;AACJ;","names":["fs"]}
@@ -0,0 +1,12 @@
1
+ import { BaseCommand, CommandDefinition } from '@nexical/cli-core';
2
+
3
+ declare class ModuleRemoveCommand extends BaseCommand {
4
+ static usage: string;
5
+ static description: string;
6
+ static requiresProject: boolean;
7
+ static args: CommandDefinition;
8
+ run(options: any): Promise<void>;
9
+ private removeFromConfig;
10
+ }
11
+
12
+ export { ModuleRemoveCommand as default };
@@ -0,0 +1,71 @@
1
+ import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_lib
4
+ } from "../../../chunk-LZ3YQWAR.js";
5
+ import {
6
+ __toESM,
7
+ init_esm_shims
8
+ } from "../../../chunk-OYFWMYPG.js";
9
+
10
+ // src/commands/module/remove.ts
11
+ init_esm_shims();
12
+ var import_fs_extra = __toESM(require_lib(), 1);
13
+ import { BaseCommand, logger, runCommand } from "@nexical/cli-core";
14
+ import path from "path";
15
+ import YAML from "yaml";
16
+ var ModuleRemoveCommand = class extends BaseCommand {
17
+ static usage = "module remove <name>";
18
+ static description = "Remove an installed module.";
19
+ static requiresProject = true;
20
+ static args = {
21
+ args: [
22
+ { name: "name", required: true, description: "Name of the module to remove" }
23
+ ]
24
+ };
25
+ async run(options) {
26
+ const projectRoot = this.projectRoot;
27
+ let { name } = options;
28
+ const relativePath = `modules/${name}`;
29
+ const fullPath = path.resolve(projectRoot, relativePath);
30
+ logger.debug("Removing module at:", fullPath);
31
+ if (!await import_fs_extra.default.pathExists(fullPath)) {
32
+ this.error(`Module ${name} not found at ${relativePath}.`);
33
+ return;
34
+ }
35
+ this.info(`Removing module ${name}...`);
36
+ try {
37
+ await runCommand(`git submodule deinit -f ${relativePath}`, projectRoot);
38
+ await runCommand(`git rm -f ${relativePath}`, projectRoot);
39
+ const gitModulesDir = path.resolve(projectRoot, ".git", "modules", "modules", name);
40
+ if (await import_fs_extra.default.pathExists(gitModulesDir)) {
41
+ await import_fs_extra.default.remove(gitModulesDir);
42
+ }
43
+ this.info("Syncing workspace dependencies...");
44
+ await runCommand("npm install", projectRoot);
45
+ await this.removeFromConfig(name);
46
+ this.success(`Module ${name} removed successfully.`);
47
+ } catch (e) {
48
+ this.error(`Failed to remove module: ${e.message}`);
49
+ }
50
+ }
51
+ async removeFromConfig(moduleName) {
52
+ const projectRoot = this.projectRoot;
53
+ const configPath = path.join(projectRoot, "nexical.yaml");
54
+ if (!await import_fs_extra.default.pathExists(configPath)) return;
55
+ try {
56
+ const content = await import_fs_extra.default.readFile(configPath, "utf8");
57
+ let config = YAML.parse(content) || {};
58
+ if (config.modules && config.modules.includes(moduleName)) {
59
+ config.modules = config.modules.filter((m) => m !== moduleName);
60
+ await import_fs_extra.default.writeFile(configPath, YAML.stringify(config));
61
+ logger.debug(`Removed ${moduleName} from nexical.yaml modules list.`);
62
+ }
63
+ } catch (e) {
64
+ logger.warn(`Failed to update nexical.yaml: ${e.message}`);
65
+ }
66
+ }
67
+ };
68
+ export {
69
+ ModuleRemoveCommand as default
70
+ };
71
+ //# sourceMappingURL=remove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/commands/module/remove.ts"],"sourcesContent":["import { type CommandDefinition, BaseCommand, logger, runCommand } from '@nexical/cli-core';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport YAML from 'yaml';\n\nexport default class ModuleRemoveCommand extends BaseCommand {\n static usage = 'module remove <name>';\n static description = 'Remove an installed module.';\n static requiresProject = true;\n\n static args: CommandDefinition = {\n args: [\n { name: 'name', required: true, description: 'Name of the module to remove' }\n ]\n };\n\n async run(options: any) {\n const projectRoot = this.projectRoot as string;\n let { name } = options;\n\n const relativePath = `modules/${name}`;\n const fullPath = path.resolve(projectRoot, relativePath);\n\n logger.debug('Removing module at:', fullPath);\n\n if (!(await fs.pathExists(fullPath))) {\n this.error(`Module ${name} not found at ${relativePath}.`);\n return;\n }\n\n this.info(`Removing module ${name}...`);\n\n try {\n await runCommand(`git submodule deinit -f ${relativePath}`, projectRoot);\n await runCommand(`git rm -f ${relativePath}`, projectRoot);\n\n // Clean up .git/modules\n const gitModulesDir = path.resolve(projectRoot, '.git', 'modules', 'modules', name);\n if (await fs.pathExists(gitModulesDir)) {\n await fs.remove(gitModulesDir);\n }\n\n this.info('Syncing workspace dependencies...');\n await runCommand('npm install', projectRoot);\n\n\n await this.removeFromConfig(name);\n\n this.success(`Module ${name} removed successfully.`);\n } catch (e: any) {\n this.error(`Failed to remove module: ${e.message}`);\n }\n }\n\n private async removeFromConfig(moduleName: string) {\n const projectRoot = this.projectRoot as string;\n const configPath = path.join(projectRoot, 'nexical.yaml');\n\n if (!await fs.pathExists(configPath)) return;\n\n try {\n const content = await fs.readFile(configPath, 'utf8');\n let config = YAML.parse(content) || {};\n\n if (config.modules && config.modules.includes(moduleName)) {\n config.modules = config.modules.filter((m: string) => m !== moduleName);\n await fs.writeFile(configPath, YAML.stringify(config));\n logger.debug(`Removed ${moduleName} from nexical.yaml modules list.`);\n }\n } catch (e: any) {\n logger.warn(`Failed to update nexical.yaml: ${e.message}`);\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA,sBAAe;AADf,SAAiC,aAAa,QAAQ,kBAAkB;AAExE,OAAO,UAAU;AACjB,OAAO,UAAU;AAEjB,IAAqB,sBAArB,cAAiD,YAAY;AAAA,EACzD,OAAO,QAAQ;AAAA,EACf,OAAO,cAAc;AAAA,EACrB,OAAO,kBAAkB;AAAA,EAEzB,OAAO,OAA0B;AAAA,IAC7B,MAAM;AAAA,MACF,EAAE,MAAM,QAAQ,UAAU,MAAM,aAAa,+BAA+B;AAAA,IAChF;AAAA,EACJ;AAAA,EAEA,MAAM,IAAI,SAAc;AACpB,UAAM,cAAc,KAAK;AACzB,QAAI,EAAE,KAAK,IAAI;AAEf,UAAM,eAAe,WAAW,IAAI;AACpC,UAAM,WAAW,KAAK,QAAQ,aAAa,YAAY;AAEvD,WAAO,MAAM,uBAAuB,QAAQ;AAE5C,QAAI,CAAE,MAAM,gBAAAA,QAAG,WAAW,QAAQ,GAAI;AAClC,WAAK,MAAM,UAAU,IAAI,iBAAiB,YAAY,GAAG;AACzD;AAAA,IACJ;AAEA,SAAK,KAAK,mBAAmB,IAAI,KAAK;AAEtC,QAAI;AACA,YAAM,WAAW,2BAA2B,YAAY,IAAI,WAAW;AACvE,YAAM,WAAW,aAAa,YAAY,IAAI,WAAW;AAGzD,YAAM,gBAAgB,KAAK,QAAQ,aAAa,QAAQ,WAAW,WAAW,IAAI;AAClF,UAAI,MAAM,gBAAAA,QAAG,WAAW,aAAa,GAAG;AACpC,cAAM,gBAAAA,QAAG,OAAO,aAAa;AAAA,MACjC;AAEA,WAAK,KAAK,mCAAmC;AAC7C,YAAM,WAAW,eAAe,WAAW;AAG3C,YAAM,KAAK,iBAAiB,IAAI;AAEhC,WAAK,QAAQ,UAAU,IAAI,wBAAwB;AAAA,IACvD,SAAS,GAAQ;AACb,WAAK,MAAM,4BAA4B,EAAE,OAAO,EAAE;AAAA,IACtD;AAAA,EACJ;AAAA,EAEA,MAAc,iBAAiB,YAAoB;AAC/C,UAAM,cAAc,KAAK;AACzB,UAAM,aAAa,KAAK,KAAK,aAAa,cAAc;AAExD,QAAI,CAAC,MAAM,gBAAAA,QAAG,WAAW,UAAU,EAAG;AAEtC,QAAI;AACA,YAAM,UAAU,MAAM,gBAAAA,QAAG,SAAS,YAAY,MAAM;AACpD,UAAI,SAAS,KAAK,MAAM,OAAO,KAAK,CAAC;AAErC,UAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,UAAU,GAAG;AACvD,eAAO,UAAU,OAAO,QAAQ,OAAO,CAAC,MAAc,MAAM,UAAU;AACtE,cAAM,gBAAAA,QAAG,UAAU,YAAY,KAAK,UAAU,MAAM,CAAC;AACrD,eAAO,MAAM,WAAW,UAAU,kCAAkC;AAAA,MACxE;AAAA,IACJ,SAAS,GAAQ;AACb,aAAO,KAAK,kCAAkC,EAAE,OAAO,EAAE;AAAA,IAC7D;AAAA,EACJ;AACJ;","names":["fs"]}
@@ -0,0 +1,11 @@
1
+ import { BaseCommand, CommandDefinition } from '@nexical/cli-core';
2
+
3
+ declare class ModuleUpdateCommand extends BaseCommand {
4
+ static usage: string;
5
+ static description: string;
6
+ static requiresProject: boolean;
7
+ static args: CommandDefinition;
8
+ run(options: any): Promise<void>;
9
+ }
10
+
11
+ export { ModuleUpdateCommand as default };
@@ -0,0 +1,52 @@
1
+ import { createRequire } from "module"; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_lib
4
+ } from "../../../chunk-LZ3YQWAR.js";
5
+ import {
6
+ __toESM,
7
+ init_esm_shims
8
+ } from "../../../chunk-OYFWMYPG.js";
9
+
10
+ // src/commands/module/update.ts
11
+ init_esm_shims();
12
+ var import_fs_extra = __toESM(require_lib(), 1);
13
+ import { BaseCommand, logger, runCommand } from "@nexical/cli-core";
14
+ import path from "path";
15
+ var ModuleUpdateCommand = class extends BaseCommand {
16
+ static usage = "module update [name]";
17
+ static description = "Update a specific module or all modules.";
18
+ static requiresProject = true;
19
+ static args = {
20
+ args: [
21
+ { name: "name", required: false, description: "Name of the module to update" }
22
+ ]
23
+ };
24
+ async run(options) {
25
+ const projectRoot = this.projectRoot;
26
+ let { name } = options;
27
+ this.info(name ? `Updating module ${name}...` : "Updating all modules...");
28
+ logger.debug("Update context:", { name, projectRoot });
29
+ try {
30
+ if (name) {
31
+ const relativePath = `modules/${name}`;
32
+ const fullPath = path.resolve(projectRoot, relativePath);
33
+ if (!await import_fs_extra.default.pathExists(fullPath)) {
34
+ this.error(`Module ${name} not found.`);
35
+ return;
36
+ }
37
+ await runCommand(`git submodule update --remote --merge ${relativePath}`, projectRoot);
38
+ } else {
39
+ await runCommand("git submodule update --remote --merge", projectRoot);
40
+ }
41
+ this.info("Syncing workspace dependencies...");
42
+ await runCommand("npm install", projectRoot);
43
+ this.success("Modules updated successfully.");
44
+ } catch (e) {
45
+ this.error(`Failed to update modules: ${e.message}`);
46
+ }
47
+ }
48
+ };
49
+ export {
50
+ ModuleUpdateCommand as default
51
+ };
52
+ //# sourceMappingURL=update.js.map