@qoder-ai/qodercli 0.2.0-1 → 0.2.1
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/LICENSE +193 -27
- package/README.md +349 -23
- package/bin/qodercli +10 -6
- package/package.json +29 -17
- package/scripts/install.js +140 -76
package/LICENSE
CHANGED
|
@@ -1,36 +1,202 @@
|
|
|
1
|
-
MIT License (for npm installer scripts only)
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
copies or substantial portions of the Software.
|
|
8
|
+
1. Definitions.
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
22
12
|
|
|
23
|
-
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
28
23
|
|
|
29
|
-
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
4. The binary may collect usage data and require authentication
|
|
35
|
-
5. Commercial use may require a separate license from Qoder AI
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
36
30
|
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,42 +1,368 @@
|
|
|
1
|
-
#
|
|
1
|
+
# qodercli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Gemini CLI is an open-source AI agent that brings the power of Gemini directly
|
|
4
|
+
into your terminal. It provides lightweight access to Gemini, giving you the
|
|
5
|
+
most direct path from your prompt to our model.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Learn all about Gemini CLI in our [documentation](https://geminicli.com/docs/).
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## 🚀 Why Gemini CLI?
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
- **🎯 Free tier**: 60 requests/min and 1,000 requests/day with personal Google
|
|
12
|
+
account.
|
|
13
|
+
- **🧠 Powerful Gemini 3 models**: Access to improved reasoning and 1M token
|
|
14
|
+
context window.
|
|
15
|
+
- **🔧 Built-in tools**: Google Search grounding, file operations, shell
|
|
16
|
+
commands, web fetching.
|
|
17
|
+
- **🔌 Extensible**: MCP (Model Context Protocol) support for custom
|
|
18
|
+
integrations.
|
|
19
|
+
- **💻 Terminal-first**: Designed for developers who live in the command line.
|
|
20
|
+
- **🛡️ Open source**: Apache 2.0 licensed.
|
|
10
21
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
## 📦 Installation
|
|
23
|
+
|
|
24
|
+
See
|
|
25
|
+
[Gemini CLI installation, execution, and releases](https://www.geminicli.com/docs/get-started/installation)
|
|
26
|
+
for recommended system specifications and a detailed installation guide.
|
|
27
|
+
|
|
28
|
+
### Quick Install
|
|
29
|
+
|
|
30
|
+
#### Run instantly with npx
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Using npx (no installation required)
|
|
34
|
+
npx @qoder-ai/qodercli
|
|
14
35
|
```
|
|
15
36
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
37
|
+
#### Install globally with npm
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g @qoder-ai/qodercli
|
|
19
41
|
```
|
|
20
42
|
|
|
21
|
-
|
|
22
|
-
|
|
43
|
+
#### Install with Anaconda (for restricted environments)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Create and activate a new environment
|
|
47
|
+
conda create -y -n gemini_env -c conda-forge nodejs
|
|
48
|
+
conda activate gemini_env
|
|
49
|
+
|
|
50
|
+
# Install qodercli globally via npm (inside the environment)
|
|
23
51
|
npm install -g @qoder-ai/qodercli
|
|
24
52
|
```
|
|
25
53
|
|
|
26
|
-
##
|
|
54
|
+
## Release Channels
|
|
55
|
+
|
|
56
|
+
See [Releases](https://www.geminicli.com/docs/changelogs) for more details.
|
|
57
|
+
|
|
58
|
+
### Preview
|
|
59
|
+
|
|
60
|
+
New preview releases will be published each week at UTC 23:59 on Tuesdays. These
|
|
61
|
+
releases will not have been fully vetted and may contain regressions or other
|
|
62
|
+
outstanding issues. Please help us test and install with `preview` tag.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm install -g @qoder-ai/qodercli@preview
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Stable
|
|
69
|
+
|
|
70
|
+
- New stable releases will be published each week at UTC 20:00 on Tuesdays, this
|
|
71
|
+
will be the full promotion of last week's `preview` release + any bug fixes
|
|
72
|
+
and validations. Use `latest` tag.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install -g @qoder-ai/qodercli@latest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Nightly
|
|
79
|
+
|
|
80
|
+
- New releases will be published each day at UTC 00:00. This will be all changes
|
|
81
|
+
from the main branch as represented at time of release. It should be assumed
|
|
82
|
+
there are pending validations and issues. Use `nightly` tag.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm install -g @qoder-ai/qodercli@nightly
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 📋 Key Features
|
|
89
|
+
|
|
90
|
+
### Code Understanding & Generation
|
|
91
|
+
|
|
92
|
+
- Query and edit large codebases
|
|
93
|
+
- Generate new apps from PDFs, images, or sketches using multimodal capabilities
|
|
94
|
+
- Debug issues and troubleshoot with natural language
|
|
95
|
+
|
|
96
|
+
### Automation & Integration
|
|
97
|
+
|
|
98
|
+
- Automate operational tasks like querying pull requests or handling complex
|
|
99
|
+
rebases
|
|
100
|
+
- Use MCP servers to connect new capabilities such as media generation, internal
|
|
101
|
+
tools, and custom automation
|
|
102
|
+
- Run non-interactively in scripts for workflow automation
|
|
103
|
+
|
|
104
|
+
### Advanced Capabilities
|
|
105
|
+
|
|
106
|
+
- Ground your queries with built-in
|
|
107
|
+
[Google Search](https://ai.google.dev/gemini-api/docs/grounding) for real-time
|
|
108
|
+
information
|
|
109
|
+
- Conversation checkpointing to save and resume complex sessions
|
|
110
|
+
- Custom context files (GEMINI.md) to tailor behavior for your projects
|
|
111
|
+
|
|
112
|
+
## 🔐 Authentication Options
|
|
113
|
+
|
|
114
|
+
Choose the authentication method that best fits your needs:
|
|
115
|
+
|
|
116
|
+
### Option 1: Sign in with Google (OAuth login using your Google Account)
|
|
117
|
+
|
|
118
|
+
**✨ Best for:** Individual developers as well as anyone who has a Gemini Code
|
|
119
|
+
Assist License. (see
|
|
120
|
+
[quota limits and terms of service](https://cloud.google.com/gemini/docs/quotas)
|
|
121
|
+
for details)
|
|
122
|
+
|
|
123
|
+
**Benefits:**
|
|
124
|
+
|
|
125
|
+
- **Free tier**: 60 requests/min and 1,000 requests/day
|
|
126
|
+
- **Gemini 3 models** with 1M token context window
|
|
127
|
+
- **No API key management** - just sign in with your Google account
|
|
128
|
+
- **Automatic updates** to latest models
|
|
129
|
+
|
|
130
|
+
#### Start Gemini CLI, then choose _Sign in with Google_ and follow the browser authentication flow when prompted
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
qodercli
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### If you are using a paid Code Assist License from your organization, remember to set the Google Cloud Project
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Set your Google Cloud Project
|
|
140
|
+
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
|
141
|
+
qodercli
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Option 2: Gemini API Key
|
|
145
|
+
|
|
146
|
+
**✨ Best for:** Developers who need specific model control or paid tier access
|
|
147
|
+
|
|
148
|
+
**Benefits:**
|
|
149
|
+
|
|
150
|
+
- **Free tier**: 1000 requests/day with Gemini 3 (mix of flash and pro)
|
|
151
|
+
- **Model selection**: Choose specific Gemini models
|
|
152
|
+
- **Usage-based billing**: Upgrade for higher limits when needed
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Get your key from https://aistudio.google.com/apikey
|
|
156
|
+
export GEMINI_API_KEY="YOUR_API_KEY"
|
|
157
|
+
qodercli
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Option 3: Vertex AI
|
|
161
|
+
|
|
162
|
+
**✨ Best for:** Enterprise teams and production workloads
|
|
163
|
+
|
|
164
|
+
**Benefits:**
|
|
165
|
+
|
|
166
|
+
- **Enterprise features**: Advanced security and compliance
|
|
167
|
+
- **Scalable**: Higher rate limits with billing account
|
|
168
|
+
- **Integration**: Works with existing Google Cloud infrastructure
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Get your key from Google Cloud Console
|
|
172
|
+
export GOOGLE_API_KEY="YOUR_API_KEY"
|
|
173
|
+
export GOOGLE_GENAI_USE_VERTEXAI=true
|
|
174
|
+
qodercli
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
For Google Workspace accounts and other authentication methods, see the
|
|
178
|
+
[authentication guide](https://www.geminicli.com/docs/get-started/authentication).
|
|
179
|
+
|
|
180
|
+
## 🚀 Getting Started
|
|
181
|
+
|
|
182
|
+
### Basic Usage
|
|
183
|
+
|
|
184
|
+
#### Start in current directory
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
qodercli
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Include multiple directories
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
qodercli --include-directories ../lib,../docs
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Use specific model
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
qodercli -m gemini-2.5-flash
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Non-interactive mode for scripts
|
|
203
|
+
|
|
204
|
+
Get a simple text response:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
qodercli -p "Explain the architecture of this codebase"
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
For more advanced scripting, including how to parse JSON and handle errors, use
|
|
211
|
+
the `--output-format json` flag to get structured output:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
qodercli -p "Explain the architecture of this codebase" --output-format json
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
For real-time event streaming (useful for monitoring long-running operations),
|
|
218
|
+
use `--output-format stream-json` to get newline-delimited JSON events:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
qodercli -p "Run tests and deploy" --output-format stream-json
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Quick Examples
|
|
225
|
+
|
|
226
|
+
#### Start a new project
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
cd new-project/
|
|
230
|
+
qodercli
|
|
231
|
+
> Write me a Discord bot that answers questions using a FAQ.md file I will provide
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### Analyze existing code
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
git clone <repository-url>
|
|
238
|
+
cd qodercli
|
|
239
|
+
qodercli
|
|
240
|
+
> Give me a summary of all of the changes that went in yesterday
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## 📚 Documentation
|
|
244
|
+
|
|
245
|
+
### Getting Started
|
|
246
|
+
|
|
247
|
+
- [**Quickstart Guide**](https://www.geminicli.com/docs/get-started) - Get up
|
|
248
|
+
and running quickly.
|
|
249
|
+
- [**Authentication Setup**](https://www.geminicli.com/docs/get-started/authentication) -
|
|
250
|
+
Detailed auth configuration.
|
|
251
|
+
- [**Configuration Guide**](https://www.geminicli.com/docs/reference/configuration) -
|
|
252
|
+
Settings and customization.
|
|
253
|
+
- [**Keyboard Shortcuts**](https://www.geminicli.com/docs/reference/keyboard-shortcuts) -
|
|
254
|
+
Productivity tips.
|
|
255
|
+
|
|
256
|
+
### Core Features
|
|
257
|
+
|
|
258
|
+
- [**Commands Reference**](https://www.geminicli.com/docs/reference/commands) -
|
|
259
|
+
All slash commands (`/help`, `/chat`, etc).
|
|
260
|
+
- [**Custom Commands**](https://www.geminicli.com/docs/cli/custom-commands) -
|
|
261
|
+
Create your own reusable commands.
|
|
262
|
+
- [**Context Files (GEMINI.md)**](https://www.geminicli.com/docs/cli/gemini-md) -
|
|
263
|
+
Provide persistent context to Gemini CLI.
|
|
264
|
+
- [**Checkpointing**](https://www.geminicli.com/docs/cli/checkpointing) - Save
|
|
265
|
+
and resume conversations.
|
|
266
|
+
- [**Token Caching**](https://www.geminicli.com/docs/cli/token-caching) -
|
|
267
|
+
Optimize token usage.
|
|
268
|
+
|
|
269
|
+
### Tools & Extensions
|
|
270
|
+
|
|
271
|
+
- [**Built-in Tools Overview**](https://www.geminicli.com/docs/reference/tools)
|
|
272
|
+
- [File System Operations](https://www.geminicli.com/docs/tools/file-system)
|
|
273
|
+
- [Shell Commands](https://www.geminicli.com/docs/tools/shell)
|
|
274
|
+
- [Web Fetch & Search](https://www.geminicli.com/docs/tools/web-fetch)
|
|
275
|
+
- [**MCP Server Integration**](https://www.geminicli.com/docs/tools/mcp-server) -
|
|
276
|
+
Extend with custom tools.
|
|
277
|
+
- [**Custom Extensions**](https://geminicli.com/docs/extensions/writing-extensions) -
|
|
278
|
+
Build and share your own commands.
|
|
279
|
+
|
|
280
|
+
### Advanced Topics
|
|
281
|
+
|
|
282
|
+
- [**Headless Mode (Scripting)**](https://www.geminicli.com/docs/cli/headless) -
|
|
283
|
+
Use Gemini CLI in automated workflows.
|
|
284
|
+
- [**IDE Integration**](https://www.geminicli.com/docs/ide-integration) - VS
|
|
285
|
+
Code companion.
|
|
286
|
+
- [**Sandboxing & Security**](https://www.geminicli.com/docs/cli/sandbox) - Safe
|
|
287
|
+
execution environments.
|
|
288
|
+
- [**Trusted Folders**](https://www.geminicli.com/docs/cli/trusted-folders) -
|
|
289
|
+
Control execution policies by folder.
|
|
290
|
+
- [**Enterprise Guide**](https://www.geminicli.com/docs/cli/enterprise) - Deploy
|
|
291
|
+
and manage in a corporate environment.
|
|
292
|
+
- [**Telemetry & Monitoring**](https://www.geminicli.com/docs/cli/telemetry) -
|
|
293
|
+
Usage tracking.
|
|
294
|
+
- [**Tools reference**](https://www.geminicli.com/docs/reference/tools) -
|
|
295
|
+
Built-in tools overview.
|
|
296
|
+
- [**Local development**](https://www.geminicli.com/docs/local-development) -
|
|
297
|
+
Local development tooling.
|
|
298
|
+
|
|
299
|
+
### Troubleshooting & Support
|
|
300
|
+
|
|
301
|
+
- [**Troubleshooting Guide**](https://www.geminicli.com/docs/resources/troubleshooting) -
|
|
302
|
+
Common issues and solutions.
|
|
303
|
+
- [**FAQ**](https://www.geminicli.com/docs/resources/faq) - Frequently asked
|
|
304
|
+
questions.
|
|
305
|
+
- Use `/bug` command to report issues directly from the CLI.
|
|
306
|
+
|
|
307
|
+
### Using MCP Servers
|
|
308
|
+
|
|
309
|
+
User-level settings live in `~/.qoder/settings.json` by default. Set
|
|
310
|
+
`QODER_CONFIG_DIR` to use a different complete config root:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
QODER_CONFIG_DIR=/tmp/qoder-dev qodercli
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
That example reads settings from `/tmp/qoder-dev/settings.json`; it does not
|
|
317
|
+
append `.qoder` to the configured path.
|
|
318
|
+
|
|
319
|
+
Configure MCP servers in the user settings file to extend Gemini CLI with custom
|
|
320
|
+
tools:
|
|
321
|
+
|
|
322
|
+
```text
|
|
323
|
+
> @slack Send a summary of today's commits to #dev channel
|
|
324
|
+
> @database Run a query to find inactive users
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
See the
|
|
328
|
+
[MCP Server Integration guide](https://www.geminicli.com/docs/tools/mcp-server)
|
|
329
|
+
for setup instructions.
|
|
330
|
+
|
|
331
|
+
## 🤝 Contributing
|
|
332
|
+
|
|
333
|
+
We welcome contributions! Gemini CLI is fully open source (Apache 2.0), and we
|
|
334
|
+
encourage the community to:
|
|
335
|
+
|
|
336
|
+
- Report bugs and suggest features.
|
|
337
|
+
- Improve documentation.
|
|
338
|
+
- Submit code improvements.
|
|
339
|
+
- Share your MCP servers and extensions.
|
|
340
|
+
|
|
341
|
+
See our [Contributing Guide](./CONTRIBUTING.md) for development setup, coding
|
|
342
|
+
standards, and how to submit pull requests.
|
|
343
|
+
|
|
344
|
+
## 📖 Resources
|
|
27
345
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
346
|
+
- **[Official Roadmap](./ROADMAP.md)** - See what's coming next.
|
|
347
|
+
- **[Changelog](https://www.geminicli.com/docs/changelogs)** - See recent
|
|
348
|
+
notable updates.
|
|
349
|
+
- **[NPM Package](https://www.npmjs.com/package/@qoder-ai/qodercli)** - Package
|
|
350
|
+
registry.
|
|
31
351
|
|
|
32
|
-
|
|
352
|
+
### Uninstall
|
|
33
353
|
|
|
34
|
-
|
|
354
|
+
See the [Uninstall Guide](https://www.geminicli.com/docs/resources/uninstall)
|
|
355
|
+
for removal instructions.
|
|
35
356
|
|
|
36
|
-
##
|
|
357
|
+
## 📄 Legal
|
|
37
358
|
|
|
38
|
-
|
|
359
|
+
- **License**: [Apache License 2.0](LICENSE)
|
|
360
|
+
- **Terms of Service**:
|
|
361
|
+
[Terms & Privacy](https://www.geminicli.com/docs/resources/tos-privacy)
|
|
362
|
+
- **Security**: [Security Policy](SECURITY.md)
|
|
39
363
|
|
|
40
|
-
|
|
364
|
+
---
|
|
41
365
|
|
|
42
|
-
|
|
366
|
+
<p align="center">
|
|
367
|
+
Built with ❤️ by Google and the open source community
|
|
368
|
+
</p>
|
package/bin/qodercli
CHANGED
|
@@ -7,12 +7,17 @@ const { spawn } = require('child_process');
|
|
|
7
7
|
const BINARY_NAME = 'qodercli';
|
|
8
8
|
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
9
9
|
const BIN_DIR = path.join(PACKAGE_ROOT, 'bin');
|
|
10
|
-
const binPath = path.join(
|
|
10
|
+
const binPath = path.join(
|
|
11
|
+
BIN_DIR,
|
|
12
|
+
BINARY_NAME + (process.platform === 'win32' ? '.exe' : ''),
|
|
13
|
+
);
|
|
11
14
|
|
|
12
15
|
function showInstallationError() {
|
|
13
|
-
console.error('
|
|
14
|
-
console.error(
|
|
15
|
-
|
|
16
|
+
console.error('qodercli binary not found');
|
|
17
|
+
console.error(
|
|
18
|
+
'This usually means the installation process failed or was incomplete.',
|
|
19
|
+
);
|
|
20
|
+
console.error('System Information for debugging:');
|
|
16
21
|
console.error(` Platform: ${process.platform} (${process.arch})`);
|
|
17
22
|
console.error(` Node.js: ${process.version}`);
|
|
18
23
|
console.error(` npm: ${process.env.npm_version || 'unknown'}`);
|
|
@@ -29,7 +34,7 @@ if (!fs.existsSync(binPath)) {
|
|
|
29
34
|
// execute the actual binary file
|
|
30
35
|
const child = spawn(binPath, process.argv.slice(2), {
|
|
31
36
|
stdio: 'inherit',
|
|
32
|
-
windowsHide: false
|
|
37
|
+
windowsHide: false,
|
|
33
38
|
});
|
|
34
39
|
|
|
35
40
|
child.on('close', (code) => {
|
|
@@ -40,4 +45,3 @@ child.on('error', (error) => {
|
|
|
40
45
|
console.error('execution failed:', error.message);
|
|
41
46
|
process.exit(1);
|
|
42
47
|
});
|
|
43
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qoder-ai/qodercli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "qodercli - npm installer",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -44,37 +44,49 @@
|
|
|
44
44
|
],
|
|
45
45
|
"preferGlobal": true,
|
|
46
46
|
"binaries": {
|
|
47
|
-
"version": "0.2.
|
|
47
|
+
"version": "0.2.1",
|
|
48
48
|
"files": [
|
|
49
49
|
{
|
|
50
|
-
"os": "
|
|
50
|
+
"os": "darwin",
|
|
51
|
+
"arch": "arm64",
|
|
52
|
+
"url": "https://qoder-ide.oss-ap-southeast-1.aliyuncs.com/qodercli/releases/0.2.1/qodercli-darwin-arm64.tar.gz",
|
|
53
|
+
"sha256": "fe6ed1782d9cc7d73c9fab996dd603081c9d4949dbdff200c1a4423cc0fdefb2"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"os": "darwin",
|
|
51
57
|
"arch": "amd64",
|
|
52
|
-
"url": "https://
|
|
53
|
-
"sha256": "
|
|
58
|
+
"url": "https://qoder-ide.oss-ap-southeast-1.aliyuncs.com/qodercli/releases/0.2.1/qodercli-darwin-x64.tar.gz",
|
|
59
|
+
"sha256": "b3cfeb89744aeaa7a02fef3395ec1575652d6aed7ff8c81e472ba619be324aa5"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"os": "linux",
|
|
63
|
+
"arch": "arm64-musl",
|
|
64
|
+
"url": "https://qoder-ide.oss-ap-southeast-1.aliyuncs.com/qodercli/releases/0.2.1/qodercli-linux-arm64-musl.tar.gz",
|
|
65
|
+
"sha256": "9e5cbe7a1206e4661d70ee33844a337942ae506a0cdbe7fa146d04a6556876af"
|
|
54
66
|
},
|
|
55
67
|
{
|
|
56
68
|
"os": "linux",
|
|
57
69
|
"arch": "arm64",
|
|
58
|
-
"url": "https://
|
|
59
|
-
"sha256": "
|
|
70
|
+
"url": "https://qoder-ide.oss-ap-southeast-1.aliyuncs.com/qodercli/releases/0.2.1/qodercli-linux-arm64.tar.gz",
|
|
71
|
+
"sha256": "5b3497a7f7217133b350f9275ceb5b0c5e56c5bb7ddc6e2a5c84cc8a62c83504"
|
|
60
72
|
},
|
|
61
73
|
{
|
|
62
|
-
"os": "
|
|
63
|
-
"arch": "amd64",
|
|
64
|
-
"url": "https://
|
|
65
|
-
"sha256": "
|
|
74
|
+
"os": "linux",
|
|
75
|
+
"arch": "amd64-musl",
|
|
76
|
+
"url": "https://qoder-ide.oss-ap-southeast-1.aliyuncs.com/qodercli/releases/0.2.1/qodercli-linux-x64-musl.tar.gz",
|
|
77
|
+
"sha256": "9ec37fb4bbe27847b44af911e9757bd517a5632162dcda04f27c01be86e936c6"
|
|
66
78
|
},
|
|
67
79
|
{
|
|
68
|
-
"os": "
|
|
69
|
-
"arch": "
|
|
70
|
-
"url": "https://
|
|
71
|
-
"sha256": "
|
|
80
|
+
"os": "linux",
|
|
81
|
+
"arch": "amd64",
|
|
82
|
+
"url": "https://qoder-ide.oss-ap-southeast-1.aliyuncs.com/qodercli/releases/0.2.1/qodercli-linux-x64.tar.gz",
|
|
83
|
+
"sha256": "93512bd6f02bc86ccc6b8a8753cf03f9620b019563da803ce40c5afb8080101d"
|
|
72
84
|
},
|
|
73
85
|
{
|
|
74
86
|
"os": "windows",
|
|
75
87
|
"arch": "amd64",
|
|
76
|
-
"url": "https://
|
|
77
|
-
"sha256": "
|
|
88
|
+
"url": "https://qoder-ide.oss-ap-southeast-1.aliyuncs.com/qodercli/releases/0.2.1/qodercli-windows-x64.zip",
|
|
89
|
+
"sha256": "df0b7306b9a1904fbb1ccf3dd250c115c056b176f6f0bb229df4c78ba98b34d6"
|
|
78
90
|
}
|
|
79
91
|
]
|
|
80
92
|
}
|
package/scripts/install.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-unused-vars, @typescript-eslint/no-this-alias, no-useless-catch, no-empty */
|
|
2
3
|
|
|
3
4
|
const fs = require('fs');
|
|
4
5
|
const path = require('path');
|
|
@@ -32,15 +33,21 @@ class QoderInstaller {
|
|
|
32
33
|
// Detect platform and architecture (will be logged if they fail)
|
|
33
34
|
this.platform = this.detectPlatform();
|
|
34
35
|
this.arch = this.detectArch();
|
|
35
|
-
this.binPath = path.join(
|
|
36
|
+
this.binPath = path.join(
|
|
37
|
+
BIN_DIR,
|
|
38
|
+
BINARY_NAME + (process.platform === 'win32' ? '.exe' : ''),
|
|
39
|
+
);
|
|
36
40
|
this.packageInfo = this.loadPackageInfo();
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
detectPlatform() {
|
|
40
44
|
switch (process.platform) {
|
|
41
|
-
case 'darwin':
|
|
42
|
-
|
|
43
|
-
case '
|
|
45
|
+
case 'darwin':
|
|
46
|
+
return 'darwin';
|
|
47
|
+
case 'linux':
|
|
48
|
+
return 'linux';
|
|
49
|
+
case 'win32':
|
|
50
|
+
return 'windows';
|
|
44
51
|
default:
|
|
45
52
|
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
46
53
|
}
|
|
@@ -49,8 +56,10 @@ class QoderInstaller {
|
|
|
49
56
|
detectArch() {
|
|
50
57
|
const arch = process.arch;
|
|
51
58
|
switch (arch) {
|
|
52
|
-
case 'x64':
|
|
53
|
-
|
|
59
|
+
case 'x64':
|
|
60
|
+
return 'amd64';
|
|
61
|
+
case 'arm64':
|
|
62
|
+
return 'arm64';
|
|
54
63
|
default:
|
|
55
64
|
throw new Error(`Unsupported architecture: ${arch}`);
|
|
56
65
|
}
|
|
@@ -65,14 +74,23 @@ class QoderInstaller {
|
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
// Create log file with timestamp
|
|
68
|
-
const timestamp = new Date()
|
|
69
|
-
|
|
77
|
+
const timestamp = new Date()
|
|
78
|
+
.toISOString()
|
|
79
|
+
.replace(/[:.]/g, '-')
|
|
80
|
+
.replace('T', '_')
|
|
81
|
+
.split('Z')[0];
|
|
82
|
+
this.logFile = path.join(
|
|
83
|
+
logDir,
|
|
84
|
+
`qodercli_install_${INSTALL_METHOD}_${timestamp}.log`,
|
|
85
|
+
);
|
|
70
86
|
|
|
71
87
|
// Create write stream
|
|
72
88
|
this.logStream = fs.createWriteStream(this.logFile, { flags: 'a' });
|
|
73
89
|
|
|
74
90
|
// Write log header
|
|
75
|
-
this.logStream.write(
|
|
91
|
+
this.logStream.write(
|
|
92
|
+
`Installation started at ${new Date().toISOString()}\n`,
|
|
93
|
+
);
|
|
76
94
|
this.logStream.write(`Installation method: ${INSTALL_METHOD}\n`);
|
|
77
95
|
this.logStream.write(`Platform: ${process.platform}/${process.arch}\n`);
|
|
78
96
|
this.logStream.write(`Node.js version: ${process.version}\n`);
|
|
@@ -96,20 +114,28 @@ class QoderInstaller {
|
|
|
96
114
|
|
|
97
115
|
// Redirect console.log and console.error to both terminal and log file
|
|
98
116
|
const self = this;
|
|
99
|
-
console.log = function(...args) {
|
|
100
|
-
const message = args
|
|
101
|
-
|
|
102
|
-
|
|
117
|
+
console.log = function (...args) {
|
|
118
|
+
const message = args
|
|
119
|
+
.map((arg) =>
|
|
120
|
+
typeof arg === 'object'
|
|
121
|
+
? JSON.stringify(arg, null, 2)
|
|
122
|
+
: String(arg),
|
|
123
|
+
)
|
|
124
|
+
.join(' ');
|
|
103
125
|
self.originalConsoleLog.apply(console, args);
|
|
104
126
|
if (self.logStream) {
|
|
105
127
|
self.logStream.write(message + '\n');
|
|
106
128
|
}
|
|
107
129
|
};
|
|
108
130
|
|
|
109
|
-
console.error = function(...args) {
|
|
110
|
-
const message = args
|
|
111
|
-
|
|
112
|
-
|
|
131
|
+
console.error = function (...args) {
|
|
132
|
+
const message = args
|
|
133
|
+
.map((arg) =>
|
|
134
|
+
typeof arg === 'object'
|
|
135
|
+
? JSON.stringify(arg, null, 2)
|
|
136
|
+
: String(arg),
|
|
137
|
+
)
|
|
138
|
+
.join(' ');
|
|
113
139
|
self.originalConsoleError.apply(console, args);
|
|
114
140
|
if (self.logStream) {
|
|
115
141
|
self.logStream.write('[ERROR] ' + message + '\n');
|
|
@@ -117,11 +143,17 @@ class QoderInstaller {
|
|
|
117
143
|
};
|
|
118
144
|
|
|
119
145
|
// Log file location saved but not printed (will show on error)
|
|
120
|
-
|
|
121
146
|
} catch (error) {
|
|
122
147
|
// If logging setup fails, continue without logging
|
|
123
|
-
this.originalConsoleError.call(
|
|
124
|
-
|
|
148
|
+
this.originalConsoleError.call(
|
|
149
|
+
console,
|
|
150
|
+
'Warning: Failed to setup logging:',
|
|
151
|
+
error.message,
|
|
152
|
+
);
|
|
153
|
+
this.originalConsoleError.call(
|
|
154
|
+
console,
|
|
155
|
+
'Installation will continue without logging',
|
|
156
|
+
);
|
|
125
157
|
}
|
|
126
158
|
}
|
|
127
159
|
|
|
@@ -164,8 +196,8 @@ class QoderInstaller {
|
|
|
164
196
|
|
|
165
197
|
findBinaryInfo() {
|
|
166
198
|
const files = this.packageInfo.binaries.files;
|
|
167
|
-
const targetFile = files.find(
|
|
168
|
-
file.os === this.platform && file.arch === this.arch
|
|
199
|
+
const targetFile = files.find(
|
|
200
|
+
(file) => file.os === this.platform && file.arch === this.arch,
|
|
169
201
|
);
|
|
170
202
|
|
|
171
203
|
if (!targetFile) {
|
|
@@ -198,7 +230,9 @@ class QoderInstaller {
|
|
|
198
230
|
console.log('Verifying file integrity...');
|
|
199
231
|
const actualSha256 = this.calculateSha256(archivePath);
|
|
200
232
|
if (actualSha256 !== expectedSha256) {
|
|
201
|
-
throw new Error(
|
|
233
|
+
throw new Error(
|
|
234
|
+
`Checksum mismatch. Expected: ${expectedSha256}, Got: ${actualSha256}`,
|
|
235
|
+
);
|
|
202
236
|
}
|
|
203
237
|
|
|
204
238
|
// Extract file to temporary directory first
|
|
@@ -210,7 +244,9 @@ class QoderInstaller {
|
|
|
210
244
|
// Move extracted binary to final destination
|
|
211
245
|
const extractedBinary = this.findExtractedBinary(extractDir);
|
|
212
246
|
if (extractedBinary.length === 0) {
|
|
213
|
-
throw new Error(
|
|
247
|
+
throw new Error(
|
|
248
|
+
`Binary file not found after extraction in ${extractDir}`,
|
|
249
|
+
);
|
|
214
250
|
}
|
|
215
251
|
|
|
216
252
|
// Try rename first (efficient), fallback to copy+delete if cross-device
|
|
@@ -219,7 +255,9 @@ class QoderInstaller {
|
|
|
219
255
|
} catch (error) {
|
|
220
256
|
if (error.code === 'EXDEV') {
|
|
221
257
|
// Cross-device link not permitted, use copy+delete fallback
|
|
222
|
-
console.log(
|
|
258
|
+
console.log(
|
|
259
|
+
'Cross-device link detected, using copy+delete method...',
|
|
260
|
+
);
|
|
223
261
|
fs.copyFileSync(extractedBinary[0], this.binPath);
|
|
224
262
|
fs.unlinkSync(extractedBinary[0]);
|
|
225
263
|
} else {
|
|
@@ -235,7 +273,6 @@ class QoderInstaller {
|
|
|
235
273
|
// Create installation source marker
|
|
236
274
|
const sourceFile = path.join(BIN_DIR, '.qodercli-install-resource');
|
|
237
275
|
fs.writeFileSync(sourceFile, 'npm', 'utf8');
|
|
238
|
-
|
|
239
276
|
} catch (error) {
|
|
240
277
|
throw error;
|
|
241
278
|
} finally {
|
|
@@ -243,7 +280,10 @@ class QoderInstaller {
|
|
|
243
280
|
try {
|
|
244
281
|
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
245
282
|
} catch (cleanupError) {
|
|
246
|
-
console.warn(
|
|
283
|
+
console.warn(
|
|
284
|
+
'Warning: Failed to cleanup temporary directory:',
|
|
285
|
+
cleanupError.message,
|
|
286
|
+
);
|
|
247
287
|
}
|
|
248
288
|
}
|
|
249
289
|
}
|
|
@@ -261,7 +301,10 @@ class QoderInstaller {
|
|
|
261
301
|
extracted = true;
|
|
262
302
|
console.log('ZIP extracted using Node.js adm-zip package');
|
|
263
303
|
} catch (error) {
|
|
264
|
-
console.log(
|
|
304
|
+
console.log(
|
|
305
|
+
'adm-zip extraction failed, trying system commands...',
|
|
306
|
+
error.message,
|
|
307
|
+
);
|
|
265
308
|
}
|
|
266
309
|
|
|
267
310
|
// Method 2: System command fallbacks
|
|
@@ -269,14 +312,17 @@ class QoderInstaller {
|
|
|
269
312
|
if (process.platform === 'win32') {
|
|
270
313
|
// Windows: Try PowerShell then 7-Zip
|
|
271
314
|
try {
|
|
272
|
-
execSync(
|
|
273
|
-
|
|
274
|
-
|
|
315
|
+
execSync(
|
|
316
|
+
`powershell -command "Expand-Archive -Path '${archivePath}' -DestinationPath '${extractDir}' -Force"`,
|
|
317
|
+
{
|
|
318
|
+
stdio: 'pipe',
|
|
319
|
+
},
|
|
320
|
+
);
|
|
275
321
|
extracted = true;
|
|
276
322
|
} catch (error) {
|
|
277
323
|
try {
|
|
278
324
|
execSync(`7z x "${archivePath}" -o"${extractDir}" -y`, {
|
|
279
|
-
stdio: 'pipe'
|
|
325
|
+
stdio: 'pipe',
|
|
280
326
|
});
|
|
281
327
|
extracted = true;
|
|
282
328
|
} catch (error2) {
|
|
@@ -287,7 +333,7 @@ class QoderInstaller {
|
|
|
287
333
|
// Unix: Use unzip command
|
|
288
334
|
try {
|
|
289
335
|
execSync(`unzip -o "${archivePath}" -d "${extractDir}"`, {
|
|
290
|
-
stdio: 'pipe'
|
|
336
|
+
stdio: 'pipe',
|
|
291
337
|
});
|
|
292
338
|
extracted = true;
|
|
293
339
|
} catch (error) {
|
|
@@ -298,7 +344,9 @@ class QoderInstaller {
|
|
|
298
344
|
|
|
299
345
|
if (!extracted) {
|
|
300
346
|
const platform = process.platform === 'win32' ? 'Windows' : 'Unix';
|
|
301
|
-
throw new Error(
|
|
347
|
+
throw new Error(
|
|
348
|
+
`ZIP extraction failed on ${platform}. Please ensure extraction tools are available.`,
|
|
349
|
+
);
|
|
302
350
|
}
|
|
303
351
|
} else {
|
|
304
352
|
// Extract tar.gz file using Node.js tar package first
|
|
@@ -310,29 +358,33 @@ class QoderInstaller {
|
|
|
310
358
|
// tar v4.x uses different API than v6.x
|
|
311
359
|
await tar.extract({
|
|
312
360
|
file: archivePath,
|
|
313
|
-
cwd: extractDir
|
|
361
|
+
cwd: extractDir,
|
|
314
362
|
});
|
|
315
363
|
extracted = true;
|
|
316
364
|
console.log('tar.gz extracted using Node.js tar package');
|
|
317
365
|
} catch (error) {
|
|
318
|
-
console.log(
|
|
366
|
+
console.log(
|
|
367
|
+
'Node.js tar extraction failed, trying system tar command...',
|
|
368
|
+
error.message,
|
|
369
|
+
);
|
|
319
370
|
}
|
|
320
371
|
|
|
321
372
|
// Method 2: System tar command fallback
|
|
322
373
|
if (!extracted) {
|
|
323
374
|
try {
|
|
324
375
|
execSync(`tar -xzf "${archivePath}" -C "${extractDir}"`, {
|
|
325
|
-
stdio: 'pipe'
|
|
376
|
+
stdio: 'pipe',
|
|
326
377
|
});
|
|
327
378
|
extracted = true;
|
|
328
379
|
} catch (error) {
|
|
329
|
-
throw new Error(
|
|
380
|
+
throw new Error(
|
|
381
|
+
'tar.gz extraction failed. Please ensure tar command is installed.',
|
|
382
|
+
);
|
|
330
383
|
}
|
|
331
384
|
}
|
|
332
385
|
}
|
|
333
386
|
}
|
|
334
387
|
|
|
335
|
-
|
|
336
388
|
calculateSha256(filePath) {
|
|
337
389
|
const fileBuffer = fs.readFileSync(filePath);
|
|
338
390
|
const hashSum = crypto.createHash('sha256');
|
|
@@ -342,7 +394,8 @@ class QoderInstaller {
|
|
|
342
394
|
|
|
343
395
|
findExtractedBinary(searchDir) {
|
|
344
396
|
const results = [];
|
|
345
|
-
const expectedFilename =
|
|
397
|
+
const expectedFilename =
|
|
398
|
+
BINARY_NAME + (process.platform === 'win32' ? '.exe' : '');
|
|
346
399
|
|
|
347
400
|
try {
|
|
348
401
|
const items = fs.readdirSync(searchDir, { withFileTypes: true });
|
|
@@ -371,21 +424,22 @@ class QoderInstaller {
|
|
|
371
424
|
if (this.logStream?.fd !== undefined) {
|
|
372
425
|
try {
|
|
373
426
|
fs.fsyncSync(this.logStream.fd);
|
|
374
|
-
} catch (e) {
|
|
375
|
-
}
|
|
427
|
+
} catch (e) {}
|
|
376
428
|
}
|
|
377
429
|
|
|
378
430
|
try {
|
|
379
431
|
const output = execSync(`"${this.binPath}" --version`, {
|
|
380
432
|
encoding: 'utf8',
|
|
381
433
|
stdio: 'pipe',
|
|
382
|
-
env: { ...process.env, QODER_CLI_INSTALL: '1' }
|
|
434
|
+
env: { ...process.env, QODER_CLI_INSTALL: '1' },
|
|
383
435
|
});
|
|
384
436
|
const versionInfo = output.trim();
|
|
385
437
|
console.log('Installation verified successfully');
|
|
386
438
|
return versionInfo;
|
|
387
439
|
} catch (error) {
|
|
388
|
-
console.warn(
|
|
440
|
+
console.warn(
|
|
441
|
+
'Warning: Unable to verify installation, but binary file exists',
|
|
442
|
+
);
|
|
389
443
|
return null;
|
|
390
444
|
}
|
|
391
445
|
}
|
|
@@ -420,41 +474,52 @@ class QoderInstaller {
|
|
|
420
474
|
port: parsedUrl.port,
|
|
421
475
|
path: parsedUrl.pathname + parsedUrl.search,
|
|
422
476
|
headers: {
|
|
423
|
-
'User-Agent': 'qodercli-installer/npm (https://qoder.com)'
|
|
424
|
-
}
|
|
477
|
+
'User-Agent': 'qodercli-installer/npm (https://qoder.com)',
|
|
478
|
+
},
|
|
425
479
|
};
|
|
426
480
|
|
|
427
|
-
const request = client
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
.
|
|
433
|
-
|
|
481
|
+
const request = client
|
|
482
|
+
.get(options, (response) => {
|
|
483
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
484
|
+
// Handle redirect
|
|
485
|
+
cleanup();
|
|
486
|
+
return this.downloadFile(
|
|
487
|
+
response.headers.location,
|
|
488
|
+
filePath,
|
|
489
|
+
timeout,
|
|
490
|
+
)
|
|
491
|
+
.then(resolve)
|
|
492
|
+
.catch(reject);
|
|
493
|
+
}
|
|
434
494
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
495
|
+
if (response.statusCode !== 200) {
|
|
496
|
+
cleanup();
|
|
497
|
+
reject(
|
|
498
|
+
new Error(
|
|
499
|
+
`HTTP ${response.statusCode}: ${response.statusMessage}`,
|
|
500
|
+
),
|
|
501
|
+
);
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
440
504
|
|
|
441
|
-
|
|
505
|
+
response.pipe(file);
|
|
442
506
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
507
|
+
file.on('finish', () => {
|
|
508
|
+
if (!cleanupDone) {
|
|
509
|
+
file.close();
|
|
510
|
+
resolve();
|
|
511
|
+
}
|
|
512
|
+
});
|
|
449
513
|
|
|
450
|
-
|
|
514
|
+
file.on('error', (error) => {
|
|
515
|
+
cleanup();
|
|
516
|
+
reject(error);
|
|
517
|
+
});
|
|
518
|
+
})
|
|
519
|
+
.on('error', (error) => {
|
|
451
520
|
cleanup();
|
|
452
521
|
reject(error);
|
|
453
522
|
});
|
|
454
|
-
}).on('error', (error) => {
|
|
455
|
-
cleanup();
|
|
456
|
-
reject(error);
|
|
457
|
-
});
|
|
458
523
|
|
|
459
524
|
// Set timeout
|
|
460
525
|
request.setTimeout(timeout, () => {
|
|
@@ -511,10 +576,9 @@ class QoderInstaller {
|
|
|
511
576
|
// Verify and get version info
|
|
512
577
|
versionInfo = this.verifyInstallation();
|
|
513
578
|
installSuccess = true;
|
|
514
|
-
|
|
515
579
|
} catch (error) {
|
|
516
580
|
console.error('');
|
|
517
|
-
console.error('
|
|
581
|
+
console.error('Installation failed:', error.message);
|
|
518
582
|
console.error('');
|
|
519
583
|
if (this.logFile) {
|
|
520
584
|
console.error(`Installation log: ${this.logFile}`);
|
|
@@ -540,9 +604,9 @@ class QoderInstaller {
|
|
|
540
604
|
console.log('');
|
|
541
605
|
|
|
542
606
|
if (versionInfo) {
|
|
543
|
-
console.log(
|
|
607
|
+
console.log(`Qoder CLI ${versionInfo} installed successfully!`);
|
|
544
608
|
} else {
|
|
545
|
-
console.log('
|
|
609
|
+
console.log('Qoder CLI installed successfully!');
|
|
546
610
|
}
|
|
547
611
|
|
|
548
612
|
console.log('');
|
|
@@ -560,7 +624,7 @@ if (require.main === module) {
|
|
|
560
624
|
installer.install();
|
|
561
625
|
} catch (error) {
|
|
562
626
|
console.error('');
|
|
563
|
-
console.error('
|
|
627
|
+
console.error('Failed to initialize installer:', error.message);
|
|
564
628
|
console.error('');
|
|
565
629
|
console.error('This might be due to Node.js version compatibility issues.');
|
|
566
630
|
console.error(`Current Node.js version: ${process.version}`);
|
|
@@ -580,4 +644,4 @@ if (require.main === module) {
|
|
|
580
644
|
}
|
|
581
645
|
}
|
|
582
646
|
|
|
583
|
-
module.exports = QoderInstaller;
|
|
647
|
+
module.exports = QoderInstaller;
|