@nexical/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy.yml +34 -0
- package/LICENSE +201 -0
- package/README.md +183 -0
- package/dist/chunk-FDJVHO4O.js +41 -0
- package/dist/chunk-FDJVHO4O.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/src/commands/admin/create-user.d.ts +15 -0
- package/dist/src/commands/admin/create-user.js +49 -0
- package/dist/src/commands/admin/create-user.js.map +1 -0
- package/dist/src/commands/branch/create.d.ts +19 -0
- package/dist/src/commands/branch/create.js +59 -0
- package/dist/src/commands/branch/create.js.map +1 -0
- package/dist/src/commands/branch/delete.d.ts +15 -0
- package/dist/src/commands/branch/delete.js +50 -0
- package/dist/src/commands/branch/delete.js.map +1 -0
- package/dist/src/commands/branch/get.d.ts +15 -0
- package/dist/src/commands/branch/get.js +53 -0
- package/dist/src/commands/branch/get.js.map +1 -0
- package/dist/src/commands/branch/list.d.ts +15 -0
- package/dist/src/commands/branch/list.js +51 -0
- package/dist/src/commands/branch/list.js.map +1 -0
- package/dist/src/commands/job/get.d.ts +15 -0
- package/dist/src/commands/job/get.js +62 -0
- package/dist/src/commands/job/get.js.map +1 -0
- package/dist/src/commands/job/list.d.ts +15 -0
- package/dist/src/commands/job/list.js +57 -0
- package/dist/src/commands/job/list.js.map +1 -0
- package/dist/src/commands/job/logs.d.ts +15 -0
- package/dist/src/commands/job/logs.js +67 -0
- package/dist/src/commands/job/logs.js.map +1 -0
- package/dist/src/commands/job/trigger.d.ts +19 -0
- package/dist/src/commands/job/trigger.js +74 -0
- package/dist/src/commands/job/trigger.js.map +1 -0
- package/dist/src/commands/login.d.ts +8 -0
- package/dist/src/commands/login.js +31 -0
- package/dist/src/commands/login.js.map +1 -0
- package/dist/src/commands/project/create.d.ts +24 -0
- package/dist/src/commands/project/create.js +63 -0
- package/dist/src/commands/project/create.js.map +1 -0
- package/dist/src/commands/project/delete.d.ts +20 -0
- package/dist/src/commands/project/delete.js +58 -0
- package/dist/src/commands/project/delete.js.map +1 -0
- package/dist/src/commands/project/get.d.ts +15 -0
- package/dist/src/commands/project/get.js +49 -0
- package/dist/src/commands/project/get.js.map +1 -0
- package/dist/src/commands/project/list.d.ts +15 -0
- package/dist/src/commands/project/list.js +45 -0
- package/dist/src/commands/project/list.js.map +1 -0
- package/dist/src/commands/project/update.d.ts +19 -0
- package/dist/src/commands/project/update.js +66 -0
- package/dist/src/commands/project/update.js.map +1 -0
- package/dist/src/commands/team/create.d.ts +19 -0
- package/dist/src/commands/team/create.js +45 -0
- package/dist/src/commands/team/create.js.map +1 -0
- package/dist/src/commands/team/delete.d.ts +20 -0
- package/dist/src/commands/team/delete.js +52 -0
- package/dist/src/commands/team/delete.js.map +1 -0
- package/dist/src/commands/team/get.d.ts +15 -0
- package/dist/src/commands/team/get.js +42 -0
- package/dist/src/commands/team/get.js.map +1 -0
- package/dist/src/commands/team/list.d.ts +8 -0
- package/dist/src/commands/team/list.js +30 -0
- package/dist/src/commands/team/list.js.map +1 -0
- package/dist/src/commands/team/member/invite.d.ts +20 -0
- package/dist/src/commands/team/member/invite.js +54 -0
- package/dist/src/commands/team/member/invite.js.map +1 -0
- package/dist/src/commands/team/member/remove.d.ts +15 -0
- package/dist/src/commands/team/member/remove.js +43 -0
- package/dist/src/commands/team/member/remove.js.map +1 -0
- package/dist/src/commands/team/update.d.ts +19 -0
- package/dist/src/commands/team/update.js +55 -0
- package/dist/src/commands/team/update.js.map +1 -0
- package/dist/src/commands/token/generate.d.ts +19 -0
- package/dist/src/commands/token/generate.js +48 -0
- package/dist/src/commands/token/generate.js.map +1 -0
- package/dist/src/commands/token/list.d.ts +8 -0
- package/dist/src/commands/token/list.js +31 -0
- package/dist/src/commands/token/list.js.map +1 -0
- package/dist/src/commands/token/revoke.d.ts +15 -0
- package/dist/src/commands/token/revoke.js +38 -0
- package/dist/src/commands/token/revoke.js.map +1 -0
- package/dist/src/commands/whoami.d.ts +8 -0
- package/dist/src/commands/whoami.js +26 -0
- package/dist/src/commands/whoami.js.map +1 -0
- package/dist/src/utils/nexical-client.d.ts +10 -0
- package/dist/src/utils/nexical-client.js +12 -0
- package/dist/src/utils/nexical-client.js.map +1 -0
- package/index.ts +14 -0
- package/package.json +32 -0
- package/src/commands/admin/create-user.ts +46 -0
- package/src/commands/branch/create.ts +57 -0
- package/src/commands/branch/delete.ts +47 -0
- package/src/commands/branch/get.ts +50 -0
- package/src/commands/branch/list.ts +50 -0
- package/src/commands/job/get.ts +59 -0
- package/src/commands/job/list.ts +56 -0
- package/src/commands/job/logs.ts +67 -0
- package/src/commands/job/trigger.ts +73 -0
- package/src/commands/login.ts +31 -0
- package/src/commands/project/create.ts +61 -0
- package/src/commands/project/delete.ts +56 -0
- package/src/commands/project/get.ts +46 -0
- package/src/commands/project/list.ts +44 -0
- package/src/commands/project/update.ts +63 -0
- package/src/commands/team/create.ts +43 -0
- package/src/commands/team/delete.ts +50 -0
- package/src/commands/team/get.ts +39 -0
- package/src/commands/team/list.ts +26 -0
- package/src/commands/team/member/invite.ts +56 -0
- package/src/commands/team/member/remove.ts +40 -0
- package/src/commands/team/update.ts +53 -0
- package/src/commands/token/generate.ts +45 -0
- package/src/commands/token/list.ts +27 -0
- package/src/commands/token/revoke.ts +35 -0
- package/src/commands/whoami.ts +21 -0
- package/src/utils/nexical-client.ts +40 -0
- package/test/e2e/.gitkeep +0 -0
- package/test/integration/commands/admin/create-user.test.ts +51 -0
- package/test/integration/commands/branch/create.test.ts +51 -0
- package/test/integration/commands/branch/delete.test.ts +43 -0
- package/test/integration/commands/branch/get.test.ts +49 -0
- package/test/integration/commands/branch/list.test.ts +47 -0
- package/test/integration/commands/job/get.test.ts +54 -0
- package/test/integration/commands/job/list.test.ts +47 -0
- package/test/integration/commands/job/logs.test.ts +47 -0
- package/test/integration/commands/job/trigger.test.ts +57 -0
- package/test/integration/commands/login.test.ts +62 -0
- package/test/integration/commands/project/create.test.ts +53 -0
- package/test/integration/commands/project/delete.test.ts +43 -0
- package/test/integration/commands/project/get.test.ts +51 -0
- package/test/integration/commands/project/list.test.ts +47 -0
- package/test/integration/commands/project/update.test.ts +53 -0
- package/test/integration/commands/team/create.test.ts +53 -0
- package/test/integration/commands/team/delete.test.ts +43 -0
- package/test/integration/commands/team/get.test.ts +50 -0
- package/test/integration/commands/team/list.test.ts +47 -0
- package/test/integration/commands/team/member/invite.test.ts +46 -0
- package/test/integration/commands/team/member/remove.test.ts +43 -0
- package/test/integration/commands/team/update.test.ts +50 -0
- package/test/integration/commands/token/generate.test.ts +51 -0
- package/test/integration/commands/token/list.test.ts +47 -0
- package/test/integration/commands/token/revoke.test.ts +43 -0
- package/test/integration/commands/whoami.test.ts +49 -0
- package/test/unit/commands/admin/create-user.test.ts +51 -0
- package/test/unit/commands/branch/create.test.ts +57 -0
- package/test/unit/commands/branch/delete.test.ts +49 -0
- package/test/unit/commands/branch/get.test.ts +67 -0
- package/test/unit/commands/branch/list.test.ts +62 -0
- package/test/unit/commands/job/get.test.ts +76 -0
- package/test/unit/commands/job/list.test.ts +62 -0
- package/test/unit/commands/job/logs.test.ts +60 -0
- package/test/unit/commands/job/trigger.test.ts +75 -0
- package/test/unit/commands/login.test.ts +64 -0
- package/test/unit/commands/project/create.test.ts +64 -0
- package/test/unit/commands/project/delete.test.ts +72 -0
- package/test/unit/commands/project/get.test.ts +73 -0
- package/test/unit/commands/project/list.test.ts +62 -0
- package/test/unit/commands/project/update.test.ts +58 -0
- package/test/unit/commands/team/create.test.ts +68 -0
- package/test/unit/commands/team/delete.test.ts +71 -0
- package/test/unit/commands/team/get.test.ts +70 -0
- package/test/unit/commands/team/list.test.ts +56 -0
- package/test/unit/commands/team/member/invite.test.ts +52 -0
- package/test/unit/commands/team/member/remove.test.ts +49 -0
- package/test/unit/commands/team/update.test.ts +63 -0
- package/test/unit/commands/token/generate.test.ts +65 -0
- package/test/unit/commands/token/list.test.ts +58 -0
- package/test/unit/commands/token/revoke.test.ts +49 -0
- package/test/unit/commands/whoami.test.ts +49 -0
- package/test/unit/utils/nexical-client.test.ts +98 -0
- package/test/utils/integration-helpers.ts +22 -0
- package/tsconfig.json +26 -0
- package/tsup.config.ts +18 -0
- package/vitest.config.ts +15 -0
- package/vitest.e2e.config.ts +10 -0
- package/vitest.integration.config.ts +22 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Deploy Nexical CLI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
deploy:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
name: Build & Publish
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout Repo
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Setup Node.js
|
|
17
|
+
uses: actions/setup-node@v4
|
|
18
|
+
with:
|
|
19
|
+
node-version: 22
|
|
20
|
+
registry-url: "https://registry.npmjs.org"
|
|
21
|
+
|
|
22
|
+
- name: Install Dependencies
|
|
23
|
+
run: npm ci
|
|
24
|
+
|
|
25
|
+
- name: Build
|
|
26
|
+
run: npm run build
|
|
27
|
+
|
|
28
|
+
- name: Test
|
|
29
|
+
run: npm run test
|
|
30
|
+
|
|
31
|
+
- name: Publish to NPM
|
|
32
|
+
run: npm publish --access public
|
|
33
|
+
env:
|
|
34
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Cellebris LTD
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Nexical CLI
|
|
2
|
+
|
|
3
|
+
The **Nexical CLI** is the official command-line interface for the Nexical Orchestrator. It allows developers, platform engineers, and administrators to interact with the Nexical API directly from their terminal.
|
|
4
|
+
|
|
5
|
+
Whether you are managing teams, configuring projects, triggering jobs, or handling authentication tokens, the CLI provides a robust and scriptable interface for all your orchestration needs.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🚀 Getting Started
|
|
10
|
+
|
|
11
|
+
### Prerequisites
|
|
12
|
+
|
|
13
|
+
- **Node.js**: v22 or higher
|
|
14
|
+
- **NPM**: v10 or higher
|
|
15
|
+
|
|
16
|
+
### Installation
|
|
17
|
+
|
|
18
|
+
Install the package from NPM package repository:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g @nexical/cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Local Development
|
|
25
|
+
|
|
26
|
+
To run the CLI locally during development, you can use `npm start`. To pass arguments to the CLI, use the `--` separator:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Example: Running the 'whoami' command
|
|
30
|
+
npm start -- whoami
|
|
31
|
+
|
|
32
|
+
# Example: Logging in
|
|
33
|
+
npm start -- login
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Alternatively, you can link the binary globally to use the `nexical` command directly:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm link
|
|
40
|
+
nexical --help
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🔑 Authentication
|
|
46
|
+
|
|
47
|
+
The CLI supports a secure **Device Flow** for authentication, making it easy to log in from your terminal without handling sensitive passwords directly.
|
|
48
|
+
|
|
49
|
+
### 1. Log In
|
|
50
|
+
Start the authentication process. This will provide a verification URL and a code.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
nexical login
|
|
54
|
+
```
|
|
55
|
+
*Follow the on-screen instructions to authorize the device via your browser.*
|
|
56
|
+
|
|
57
|
+
### 2. Verify Session
|
|
58
|
+
Check your current logged-in status and user details.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
nexical whoami
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 🛠️ Usage & Commands
|
|
67
|
+
|
|
68
|
+
The CLI is structured into resource-based commands. You can always run `nexical <command> --help` to see available subcommands and options.
|
|
69
|
+
|
|
70
|
+
### 👥 Teams (`team`)
|
|
71
|
+
|
|
72
|
+
Manage user teams and memberships.
|
|
73
|
+
|
|
74
|
+
| Command | Usage | Description |
|
|
75
|
+
| :--- | :--- | :--- |
|
|
76
|
+
| `list` | `nexical team list` | List all teams you belong to or own. |
|
|
77
|
+
| `create` | `nexical team create <name> [--slug <slug>]` | Create a new team. |
|
|
78
|
+
| `get` | `nexical team get <teamId>` | View details of a specific team. |
|
|
79
|
+
| `update` | `nexical team update <teamId> [--name <n>] [--slug <s>]` | Update team settings. |
|
|
80
|
+
| `invite` | `nexical team invite <teamId> <email> [--role <role>]` | Invite a user to a team. |
|
|
81
|
+
| `delete` | `nexical team delete <teamId> [--confirm]` | Delete a team permanently. |
|
|
82
|
+
|
|
83
|
+
### 📂 Projects (`project`)
|
|
84
|
+
|
|
85
|
+
Manage projects within your teams.
|
|
86
|
+
|
|
87
|
+
| Command | Usage | Description |
|
|
88
|
+
| :--- | :--- | :--- |
|
|
89
|
+
| `list` | `nexical project list <teamId>` | List all projects in a team. |
|
|
90
|
+
| `create` | `nexical project create <teamId> <name> [--repo <url>]` | Create a new project. |
|
|
91
|
+
| `get` | `nexical project get <teamId> <projectId>` | Get project details. |
|
|
92
|
+
| `update` | `nexical project update <teamId> <projectId> ...` | Update project configuration. |
|
|
93
|
+
| `delete` | `nexical project delete <teamId> <projectId>` | Delete a project. |
|
|
94
|
+
|
|
95
|
+
### 🌿 Branches (`branch`)
|
|
96
|
+
|
|
97
|
+
Manage development branches for your projects.
|
|
98
|
+
|
|
99
|
+
| Command | Usage | Description |
|
|
100
|
+
| :--- | :--- | :--- |
|
|
101
|
+
| `list` | `nexical branch list <teamId> <projectId>` | List branches. |
|
|
102
|
+
| `create` | `nexical branch create <teamId> <projectId> <name>` | Create a branch. |
|
|
103
|
+
| `get` | `nexical branch get <teamId> <projectId> <branchId>` | Get branch details. |
|
|
104
|
+
| `delete` | `nexical branch delete ...` | Delete a branch. |
|
|
105
|
+
|
|
106
|
+
### ⚙️ Jobs (`job`)
|
|
107
|
+
|
|
108
|
+
Trigger and monitor orchestration jobs.
|
|
109
|
+
|
|
110
|
+
| Command | Usage | Description |
|
|
111
|
+
| :--- | :--- | :--- |
|
|
112
|
+
| `list` | `nexical job list <teamId> <projectId> <branchId>` | List recent jobs. |
|
|
113
|
+
| `trigger`| `nexical job trigger ... <type> [--input <json>]` | Trigger a new job (e.g., deploy). |
|
|
114
|
+
| `get` | `nexical job get ... <jobId>` | Get job details. |
|
|
115
|
+
| `logs` | `nexical job logs ... <jobId>` | Stream or view logs for a job. |
|
|
116
|
+
|
|
117
|
+
### 🎟️ API Tokens (`token`)
|
|
118
|
+
|
|
119
|
+
Manage personal access tokens for scripting and CI/CD.
|
|
120
|
+
|
|
121
|
+
| Command | Usage | Description |
|
|
122
|
+
| :--- | :--- | :--- |
|
|
123
|
+
| `list` | `nexical token list` | List your active tokens. |
|
|
124
|
+
| `create` | `nexical token create <name> [--scopes <list>]` | Generate a new API token. |
|
|
125
|
+
| `revoke` | `nexical token revoke <id>` | Revoke a token. |
|
|
126
|
+
|
|
127
|
+
### 🛡️ Admin (`admin`)
|
|
128
|
+
|
|
129
|
+
System administration commands (requires elevated permissions).
|
|
130
|
+
|
|
131
|
+
| Command | Usage | Description |
|
|
132
|
+
| :--- | :--- | :--- |
|
|
133
|
+
| `create-user` | `nexical admin create-user <name> <email> <password>` | Create a system user. |
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 🏗️ Project Structure
|
|
138
|
+
|
|
139
|
+
The codebase is organized to be modular and extensible:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
src/
|
|
143
|
+
├── commands/ # Command implementations
|
|
144
|
+
│ ├── team/ # Team-related commands
|
|
145
|
+
│ ├── project/ # Project-related commands
|
|
146
|
+
│ └── ...
|
|
147
|
+
├── utils/ # Shared utilities (API client, config)
|
|
148
|
+
└── index.ts # CLI entry point
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Each command is a class extending `BaseCommand` from `@nexical/cli-core`, enforcing a consistent structure for arguments, help text, and error handling.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 🧪 Testing
|
|
156
|
+
|
|
157
|
+
We use **Vitest** for testing.
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Run unit tests
|
|
161
|
+
npm run test:unit
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 🤝 Contributing
|
|
167
|
+
|
|
168
|
+
1. **Fork** the repository.
|
|
169
|
+
2. **Clone** your fork.
|
|
170
|
+
3. **Install** dependencies (`npm install`).
|
|
171
|
+
4. **Creating a Command**:
|
|
172
|
+
- Add a new file in `src/commands/<topic>/<verb>.ts`.
|
|
173
|
+
- Extend `BaseCommand`.
|
|
174
|
+
- Define `static description` and `static args`.
|
|
175
|
+
- Implement `run()`.
|
|
176
|
+
5. **Test** your changes.
|
|
177
|
+
6. **Submit** a Pull Request.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
Apache-2.0
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createRequire } from "module"; const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/utils/nexical-client.ts
|
|
4
|
+
import { NexicalClient } from "@nexical/sdk";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import os from "os";
|
|
8
|
+
var CONFIG_DIR = path.join(os.homedir(), ".nexical");
|
|
9
|
+
var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
10
|
+
function getConfig() {
|
|
11
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
const content = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
16
|
+
return JSON.parse(content);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function saveToken(token) {
|
|
22
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
23
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
const config = getConfig();
|
|
26
|
+
config.token = token;
|
|
27
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
28
|
+
}
|
|
29
|
+
function getClient() {
|
|
30
|
+
const config = getConfig();
|
|
31
|
+
return new NexicalClient({
|
|
32
|
+
token: config.token
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
getConfig,
|
|
38
|
+
saveToken,
|
|
39
|
+
getClient
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=chunk-FDJVHO4O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/nexical-client.ts"],"sourcesContent":["\nimport { NexicalClient } from '@nexical/sdk';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport os from 'node:os';\n\nconst CONFIG_DIR = path.join(os.homedir(), '.nexical');\nconst CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');\n\ninterface Config {\n token?: string;\n}\n\nexport function getConfig(): Config {\n if (!fs.existsSync(CONFIG_FILE)) {\n return {};\n }\n try {\n const content = fs.readFileSync(CONFIG_FILE, 'utf-8');\n return JSON.parse(content);\n } catch (error) {\n return {};\n }\n}\n\nexport function saveToken(token: string) {\n if (!fs.existsSync(CONFIG_DIR)) {\n fs.mkdirSync(CONFIG_DIR, { recursive: true });\n }\n const config = getConfig();\n config.token = token;\n fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));\n}\n\nexport function getClient(): NexicalClient {\n const config = getConfig();\n return new NexicalClient({\n token: config.token,\n });\n}\n"],"mappings":";;;AACA,SAAS,qBAAqB;AAC9B,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AAEf,IAAM,aAAa,KAAK,KAAK,GAAG,QAAQ,GAAG,UAAU;AACrD,IAAM,cAAc,KAAK,KAAK,YAAY,aAAa;AAMhD,SAAS,YAAoB;AAChC,MAAI,CAAC,GAAG,WAAW,WAAW,GAAG;AAC7B,WAAO,CAAC;AAAA,EACZ;AACA,MAAI;AACA,UAAM,UAAU,GAAG,aAAa,aAAa,OAAO;AACpD,WAAO,KAAK,MAAM,OAAO;AAAA,EAC7B,SAAS,OAAO;AACZ,WAAO,CAAC;AAAA,EACZ;AACJ;AAEO,SAAS,UAAU,OAAe;AACrC,MAAI,CAAC,GAAG,WAAW,UAAU,GAAG;AAC5B,OAAG,UAAU,YAAY,EAAE,WAAW,KAAK,CAAC;AAAA,EAChD;AACA,QAAM,SAAS,UAAU;AACzB,SAAO,QAAQ;AACf,KAAG,cAAc,aAAa,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AACjE;AAEO,SAAS,YAA2B;AACvC,QAAM,SAAS,UAAU;AACzB,SAAO,IAAI,cAAc;AAAA,IACrB,OAAO,OAAO;AAAA,EAClB,CAAC;AACL;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "module"; const require = createRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// index.ts
|
|
5
|
+
import { CLI, logger } from "@nexical/cli-core";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
|
+
logger.debug("CLI ENTRY POINT HIT", process.argv);
|
|
10
|
+
var app = new CLI({
|
|
11
|
+
commandName: "nexical",
|
|
12
|
+
searchDirectories: [path.resolve(__dirname, "./src/commands")]
|
|
13
|
+
});
|
|
14
|
+
app.start();
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { CLI, logger } from \"@nexical/cli-core\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nlogger.debug(\"CLI ENTRY POINT HIT\", process.argv);\n\nconst app = new CLI({\n commandName: \"nexical\",\n searchDirectories: [path.resolve(__dirname, \"./src/commands\")],\n});\napp.start();\n"],"mappings":";;;;AACA,SAAS,KAAK,cAAc;AAC5B,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAE9B,IAAM,YAAY,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAE7D,OAAO,MAAM,uBAAuB,QAAQ,IAAI;AAEhD,IAAM,MAAM,IAAI,IAAI;AAAA,EAClB,aAAa;AAAA,EACb,mBAAmB,CAAC,KAAK,QAAQ,WAAW,gBAAgB,CAAC;AAC/D,CAAC;AACD,IAAI,MAAM;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '@nexical/cli-core';
|
|
2
|
+
|
|
3
|
+
declare class AdminUsersCreateSystemCommand 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 { AdminUsersCreateSystemCommand as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createRequire } from "module"; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getClient
|
|
4
|
+
} from "../../../chunk-FDJVHO4O.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/admin/create-user.ts
|
|
7
|
+
import { BaseCommand } from "@nexical/cli-core";
|
|
8
|
+
var AdminUsersCreateSystemCommand = class extends BaseCommand {
|
|
9
|
+
static description = "Create a new system user";
|
|
10
|
+
static args = {
|
|
11
|
+
args: [
|
|
12
|
+
{
|
|
13
|
+
name: "name",
|
|
14
|
+
required: true,
|
|
15
|
+
description: "System user name"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "email",
|
|
19
|
+
required: true,
|
|
20
|
+
description: "System user email"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "password",
|
|
24
|
+
required: true,
|
|
25
|
+
description: "System user password"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
};
|
|
29
|
+
async run(options) {
|
|
30
|
+
const client = getClient();
|
|
31
|
+
const { name, email, password } = options;
|
|
32
|
+
try {
|
|
33
|
+
const response = await client.auth.createSystemUser({
|
|
34
|
+
fullName: name,
|
|
35
|
+
email,
|
|
36
|
+
password
|
|
37
|
+
});
|
|
38
|
+
const user = response.user;
|
|
39
|
+
this.success(`System user "${user.fullName}" created!`);
|
|
40
|
+
this.info(`ID: ${user.id}`);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
this.error(`Failed to create system user: ${error.message}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
AdminUsersCreateSystemCommand as default
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=create-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/commands/admin/create-user.ts"],"sourcesContent":["\nimport { BaseCommand } from '@nexical/cli-core';\nimport { getClient } from '../../utils/nexical-client.js';\n\nexport default class AdminUsersCreateSystemCommand extends BaseCommand {\n static description = 'Create a new system user';\n\n static args = {\n args: [\n {\n name: 'name',\n required: true,\n description: 'System user name',\n },\n {\n name: 'email',\n required: true,\n description: 'System user email',\n },\n {\n name: 'password',\n required: true,\n description: 'System user password',\n },\n ],\n };\n\n async run(options: any) {\n const client = getClient();\n const { name, email, password } = options;\n\n try {\n const response = await client.auth.createSystemUser({\n fullName: name,\n email,\n password,\n });\n const user = response.user;\n\n this.success(`System user \"${user.fullName}\" created!`);\n this.info(`ID: ${user.id}`);\n } catch (error: any) {\n this.error(`Failed to create system user: ${error.message}`);\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAS,mBAAmB;AAG5B,IAAqB,gCAArB,cAA2D,YAAY;AAAA,EACnE,OAAO,cAAc;AAAA,EAErB,OAAO,OAAO;AAAA,IACV,MAAM;AAAA,MACF;AAAA,QACI,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACjB;AAAA,MACA;AAAA,QACI,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACjB;AAAA,MACA;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,MAAM,OAAO,SAAS,IAAI;AAElC,QAAI;AACA,YAAM,WAAW,MAAM,OAAO,KAAK,iBAAiB;AAAA,QAChD,UAAU;AAAA,QACV;AAAA,QACA;AAAA,MACJ,CAAC;AACD,YAAM,OAAO,SAAS;AAEtB,WAAK,QAAQ,gBAAgB,KAAK,QAAQ,YAAY;AACtD,WAAK,KAAK,OAAO,KAAK,EAAE,EAAE;AAAA,IAC9B,SAAS,OAAY;AACjB,WAAK,MAAM,iCAAiC,MAAM,OAAO,EAAE;AAAA,IAC/D;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseCommand } from '@nexical/cli-core';
|
|
2
|
+
|
|
3
|
+
declare class BranchesCreateCommand 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 { BranchesCreateCommand as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createRequire } from "module"; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getClient
|
|
4
|
+
} from "../../../chunk-FDJVHO4O.js";
|
|
5
|
+
|
|
6
|
+
// src/commands/branch/create.ts
|
|
7
|
+
import { BaseCommand } from "@nexical/cli-core";
|
|
8
|
+
var BranchesCreateCommand = class extends BaseCommand {
|
|
9
|
+
static description = "Create a new branch";
|
|
10
|
+
static args = {
|
|
11
|
+
args: [
|
|
12
|
+
{
|
|
13
|
+
name: "teamId",
|
|
14
|
+
required: true,
|
|
15
|
+
description: "Team ID"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "projectId",
|
|
19
|
+
required: true,
|
|
20
|
+
description: "Project ID"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "name",
|
|
24
|
+
required: true,
|
|
25
|
+
description: "Name of the branch"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
options: [
|
|
29
|
+
{
|
|
30
|
+
name: "--preview <url>",
|
|
31
|
+
description: "Preview URL"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
async run(options) {
|
|
36
|
+
const client = getClient();
|
|
37
|
+
const { teamId, projectId, name, preview } = options;
|
|
38
|
+
const tid = parseInt(teamId, 10);
|
|
39
|
+
const pid = parseInt(projectId, 10);
|
|
40
|
+
if (isNaN(tid) || isNaN(pid)) {
|
|
41
|
+
this.error("IDs must be numbers.");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const branch = await client.branches.create(tid, pid, {
|
|
46
|
+
name,
|
|
47
|
+
previewUrl: preview
|
|
48
|
+
});
|
|
49
|
+
this.success(`Branch "${branch.name}" created!`);
|
|
50
|
+
this.info(`ID: ${branch.id}`);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
this.error(`Failed to create branch: ${error.message}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
BranchesCreateCommand as default
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/commands/branch/create.ts"],"sourcesContent":["\nimport { BaseCommand } from '@nexical/cli-core';\nimport { getClient } from '../../utils/nexical-client.js';\n\nexport default class BranchesCreateCommand extends BaseCommand {\n static description = 'Create a new branch';\n\n static args = {\n args: [\n {\n name: 'teamId',\n required: true,\n description: 'Team ID',\n },\n {\n name: 'projectId',\n required: true,\n description: 'Project ID',\n },\n {\n name: 'name',\n required: true,\n description: 'Name of the branch',\n },\n ],\n options: [\n {\n name: '--preview <url>',\n description: 'Preview URL',\n },\n ],\n };\n\n async run(options: any) {\n const client = getClient();\n const { teamId, projectId, name, preview } = options;\n const tid = parseInt(teamId, 10);\n const pid = parseInt(projectId, 10);\n\n if (isNaN(tid) || isNaN(pid)) {\n this.error('IDs must be numbers.');\n return;\n }\n\n try {\n const branch = await client.branches.create(tid, pid, {\n name,\n previewUrl: preview,\n });\n\n this.success(`Branch \"${branch.name}\" created!`);\n this.info(`ID: ${branch.id}`);\n } catch (error: any) {\n this.error(`Failed to create branch: ${error.message}`);\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAS,mBAAmB;AAG5B,IAAqB,wBAArB,cAAmD,YAAY;AAAA,EAC3D,OAAO,cAAc;AAAA,EAErB,OAAO,OAAO;AAAA,IACV,MAAM;AAAA,MACF;AAAA,QACI,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACjB;AAAA,MACA;AAAA,QACI,MAAM;AAAA,QACN,UAAU;AAAA,QACV,aAAa;AAAA,MACjB;AAAA,MACA;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,IACJ;AAAA,EACJ;AAAA,EAEA,MAAM,IAAI,SAAc;AACpB,UAAM,SAAS,UAAU;AACzB,UAAM,EAAE,QAAQ,WAAW,MAAM,QAAQ,IAAI;AAC7C,UAAM,MAAM,SAAS,QAAQ,EAAE;AAC/B,UAAM,MAAM,SAAS,WAAW,EAAE;AAElC,QAAI,MAAM,GAAG,KAAK,MAAM,GAAG,GAAG;AAC1B,WAAK,MAAM,sBAAsB;AACjC;AAAA,IACJ;AAEA,QAAI;AACA,YAAM,SAAS,MAAM,OAAO,SAAS,OAAO,KAAK,KAAK;AAAA,QAClD;AAAA,QACA,YAAY;AAAA,MAChB,CAAC;AAED,WAAK,QAAQ,WAAW,OAAO,IAAI,YAAY;AAC/C,WAAK,KAAK,OAAO,OAAO,EAAE,EAAE;AAAA,IAChC,SAAS,OAAY;AACjB,WAAK,MAAM,4BAA4B,MAAM,OAAO,EAAE;AAAA,IAC1D;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '@nexical/cli-core';
|
|
2
|
+
|
|
3
|
+
declare class BranchesDeleteCommand 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 { BranchesDeleteCommand as default };
|