@mk-co/neox-cli 0.0.0-reserved → 2.1.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 +254 -0
- package/README.md +38 -8
- package/bin/neox +2 -0
- package/cli-wrapper.cjs +83 -0
- package/install.cjs +101 -0
- package/package.json +38 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 19 November 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
Preamble
|
|
9
|
+
|
|
10
|
+
The GNU Affero General Public License is a free, copyleft license for
|
|
11
|
+
software and other kinds of works, specifically designed to ensure
|
|
12
|
+
cooperation with the community in the case of network server software.
|
|
13
|
+
|
|
14
|
+
The licenses for most software and other practical works are designed
|
|
15
|
+
to take away your freedom to share and change the works. By contrast,
|
|
16
|
+
our General Public Licenses are intended to guarantee your freedom to
|
|
17
|
+
share and change all versions of a program--to make sure it remains free
|
|
18
|
+
software for all its users.
|
|
19
|
+
|
|
20
|
+
When we speak of free software, we are referring to freedom, not
|
|
21
|
+
price. Our General Public Licenses are designed to make sure that you
|
|
22
|
+
have the freedom to distribute copies of free software (and charge for
|
|
23
|
+
them if you wish), that you receive source code or can get it if you
|
|
24
|
+
want it, that you can change the software or use pieces of it in new
|
|
25
|
+
free programs, and that you know you can do these things.
|
|
26
|
+
|
|
27
|
+
Developers that use our General Public Licenses protect your rights
|
|
28
|
+
with two steps: (1) assert copyright on the software, and (2) offer
|
|
29
|
+
you this License which gives you legal permission to copy, distribute
|
|
30
|
+
and/or modify the software.
|
|
31
|
+
|
|
32
|
+
A secondary benefit of defending all users' freedom is that
|
|
33
|
+
improvements made in alternate versions of the program, if they
|
|
34
|
+
receive widespread use, become available for other developers to
|
|
35
|
+
incorporate. Many developers of free software are heartened and
|
|
36
|
+
encouraged by the resulting cooperation. However, in the case of
|
|
37
|
+
software used on network servers, this result may fail to come about.
|
|
38
|
+
The GNU General Public License permits making a modified version and
|
|
39
|
+
letting the public access it on a server without ever releasing its
|
|
40
|
+
source code to the public.
|
|
41
|
+
|
|
42
|
+
The GNU Affero General Public License is designed specifically to
|
|
43
|
+
ensure that, in such cases, the modified source code becomes available
|
|
44
|
+
to the community. It requires the operator of a network server to
|
|
45
|
+
provide the source code of the modified version running there to the
|
|
46
|
+
users of that server. Therefore, public use of a modified version, on
|
|
47
|
+
a publicly accessible server, gives the public access to the source
|
|
48
|
+
code of the modified version.
|
|
49
|
+
|
|
50
|
+
An older license, called the Affero General Public License and
|
|
51
|
+
published by Affero, was designed to accomplish similar goals. This is
|
|
52
|
+
a different license, not a version of the Affero GPL, but Affero has
|
|
53
|
+
released a new version of the Affero GPL which permits relicensing under
|
|
54
|
+
this license.
|
|
55
|
+
|
|
56
|
+
The precise terms and conditions for copying, distribution and
|
|
57
|
+
modification follow.
|
|
58
|
+
|
|
59
|
+
TERMS AND CONDITIONS
|
|
60
|
+
|
|
61
|
+
0. Definitions.
|
|
62
|
+
|
|
63
|
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
64
|
+
|
|
65
|
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
66
|
+
works, such as semiconductor masks.
|
|
67
|
+
|
|
68
|
+
"The Program" refers to any copyrightable work licensed under this
|
|
69
|
+
License. Each licensee is addressed as "you". "Licensees" and
|
|
70
|
+
"recipients" may be individuals or organizations.
|
|
71
|
+
|
|
72
|
+
To "modify" a work means to copy from or adapt all or part of the work
|
|
73
|
+
in a fashion requiring copyright permission, other than the making of an
|
|
74
|
+
exact copy. The resulting work is called a "modified version" of the
|
|
75
|
+
earlier work or a work "based on" the earlier work.
|
|
76
|
+
|
|
77
|
+
A "covered work" means either the unmodified Program or a work based
|
|
78
|
+
on the Program.
|
|
79
|
+
|
|
80
|
+
To "propagate" a work means to do anything with it that, without
|
|
81
|
+
permission, would make you directly or secondarily liable for
|
|
82
|
+
infringement under applicable copyright law, except executing it on a
|
|
83
|
+
computer or modifying a private copy. Propagation includes copying,
|
|
84
|
+
distribution (with or without modification), making available to the
|
|
85
|
+
public, and in some countries other activities as well.
|
|
86
|
+
|
|
87
|
+
To "convey" a work means any kind of propagation that enables other
|
|
88
|
+
parties to make or receive copies. Mere interaction with a user through
|
|
89
|
+
a computer network, with no transfer of a copy, is not conveying.
|
|
90
|
+
|
|
91
|
+
An interactive user interface displays "Appropriate Legal Notices"
|
|
92
|
+
to the extent that it includes a convenient and prominently visible
|
|
93
|
+
feature that (1) displays an appropriate copyright notice, and (2)
|
|
94
|
+
tells the user that there is no warranty for the work (except to the
|
|
95
|
+
extent that warranties are provided), that licensees may convey the
|
|
96
|
+
work under this License, and how to view a copy of this License. If
|
|
97
|
+
the interface presents a list of user commands or options, such as a
|
|
98
|
+
menu, a prominent item in the list meets this criterion.
|
|
99
|
+
|
|
100
|
+
1. Source Code.
|
|
101
|
+
|
|
102
|
+
The "source code" for a work means the preferred form of the work
|
|
103
|
+
for making modifications to it. "Object code" means any non-source
|
|
104
|
+
form of a work.
|
|
105
|
+
|
|
106
|
+
A "Standard Interface" means an interface that either is an official
|
|
107
|
+
standard defined by a recognized standards body, or, in the case of
|
|
108
|
+
interfaces specified for a particular programming language, one that
|
|
109
|
+
is widely used among developers working in that language.
|
|
110
|
+
|
|
111
|
+
The "System Libraries" of an executable work include anything, other
|
|
112
|
+
than the work as a whole, that (a) is included in the normal form of
|
|
113
|
+
packaging a Major Component, but which is not part of that Major
|
|
114
|
+
Component, and (b) serves only to enable use of the work with that
|
|
115
|
+
Major Component, or to implement a Standard Interface for which an
|
|
116
|
+
implementation is available to the public in source code form. A
|
|
117
|
+
"Major Component", in this context, means a major essential component
|
|
118
|
+
(kernel, window system, and so on) of the specific operating system
|
|
119
|
+
(if any) on which the executable work runs, or a compiler used to
|
|
120
|
+
produce the work, or an object code interpreter used to run it.
|
|
121
|
+
|
|
122
|
+
The "Corresponding Source" for a work in object code form means all
|
|
123
|
+
the source code needed to generate, install, and (for an executable
|
|
124
|
+
work) run the object code and to modify the work, including scripts to
|
|
125
|
+
control those activities. However, it does not include the work's
|
|
126
|
+
System Libraries, or general-purpose tools or generally available free
|
|
127
|
+
programs which are used unmodified in performing those activities but
|
|
128
|
+
which are not part of the work. For example, Corresponding Source
|
|
129
|
+
includes interface definition files associated with source files for
|
|
130
|
+
the work, and the source code for shared libraries and dynamically
|
|
131
|
+
linked subprograms that the work is specifically designed to require,
|
|
132
|
+
such as by intimate data communication or control flow between those
|
|
133
|
+
subprograms and other parts of the work.
|
|
134
|
+
|
|
135
|
+
The Corresponding Source need not include anything that users
|
|
136
|
+
can regenerate automatically from other parts of the Corresponding
|
|
137
|
+
Source.
|
|
138
|
+
|
|
139
|
+
The Corresponding Source for a work in source code form is that
|
|
140
|
+
same work.
|
|
141
|
+
|
|
142
|
+
2. Basic Permissions.
|
|
143
|
+
|
|
144
|
+
All rights granted under this License are granted for the term of
|
|
145
|
+
copyright on the Program, and are irrevocable provided the stated
|
|
146
|
+
conditions are met. This License explicitly affirms your unlimited
|
|
147
|
+
permission to run the unmodified Program. The output from running a
|
|
148
|
+
covered work is covered by this License only if the output, given its
|
|
149
|
+
content, constitutes a covered work. This License acknowledges your
|
|
150
|
+
rights of fair use or other equivalent, as provided by copyright law.
|
|
151
|
+
|
|
152
|
+
You may make, run and propagate covered works that you do not
|
|
153
|
+
convey, without conditions so long as your license otherwise remains
|
|
154
|
+
in force. You may convey covered works to others for the sole purpose
|
|
155
|
+
of having them make modifications exclusively for you, or provide you
|
|
156
|
+
with facilities for running those works, provided that you comply with
|
|
157
|
+
the terms of this License in conveying all material for which you do
|
|
158
|
+
not control copyright. Those thus making or running the covered works
|
|
159
|
+
for you must do so exclusively on your behalf, under your direction
|
|
160
|
+
and control, on terms that prohibit them from making any copies of
|
|
161
|
+
your copyrighted material outside their relationship with you.
|
|
162
|
+
|
|
163
|
+
Conveying under any other circumstances is permitted solely under
|
|
164
|
+
the conditions stated below. Sublicensing is not allowed; section 10
|
|
165
|
+
makes it unnecessary.
|
|
166
|
+
|
|
167
|
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
168
|
+
|
|
169
|
+
No covered work shall be deemed part of an effective technological
|
|
170
|
+
measure under any applicable law fulfilling obligations under article
|
|
171
|
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
172
|
+
similar laws prohibiting or restricting circumvention of such
|
|
173
|
+
measures.
|
|
174
|
+
|
|
175
|
+
When you convey a covered work, you waive any legal power to forbid
|
|
176
|
+
circumvention of technological measures to the extent such circumvention
|
|
177
|
+
is effected by exercising rights under this License with respect to
|
|
178
|
+
the covered work, and you disclaim any intention to limit operation or
|
|
179
|
+
modification of the work as a means of enforcing, against the work's
|
|
180
|
+
users, your or third parties' legal rights to forbid circumvention of
|
|
181
|
+
technological measures.
|
|
182
|
+
|
|
183
|
+
4. Conveying Verbatim Copies.
|
|
184
|
+
|
|
185
|
+
You may convey verbatim copies of the Program's source code as you
|
|
186
|
+
receive it, in any medium, provided that you conspicuously and
|
|
187
|
+
appropriately publish on each copy an appropriate copyright notice;
|
|
188
|
+
keep intact all notices stating that this License and any
|
|
189
|
+
non-permissive terms added in accord with section 7 apply to the code;
|
|
190
|
+
keep intact all notices of the absence of any warranty; and give all
|
|
191
|
+
recipients a copy of this License along with the Program.
|
|
192
|
+
|
|
193
|
+
You may charge any price or no price for each copy that you convey,
|
|
194
|
+
and you may offer support or warranty protection for a fee.
|
|
195
|
+
|
|
196
|
+
5. Conveying Modified Source Versions.
|
|
197
|
+
|
|
198
|
+
You may convey a work based on the Program, or the modifications to
|
|
199
|
+
produce it from the Program, in the form of source code under the
|
|
200
|
+
terms of section 4, provided that you also meet all of these conditions:
|
|
201
|
+
|
|
202
|
+
a) The work must carry prominent notices stating that you modified
|
|
203
|
+
it, and giving a relevant date.
|
|
204
|
+
|
|
205
|
+
b) The work must carry prominent notices stating that it is
|
|
206
|
+
released under this License and any conditions added under section
|
|
207
|
+
7. This requirement modifies the requirement in section 4 to
|
|
208
|
+
"keep intact all notices".
|
|
209
|
+
|
|
210
|
+
c) You must license the entire work, as a whole, under this
|
|
211
|
+
License to anyone who comes into possession of a copy. This
|
|
212
|
+
License will therefore apply, along with any applicable section 7
|
|
213
|
+
additional terms, to the whole of the work, and all its parts,
|
|
214
|
+
regardless of how they are packaged. This License gives no
|
|
215
|
+
permission to license the work in any other way, but it does not
|
|
216
|
+
invalidate such permission if you have separately received it.
|
|
217
|
+
|
|
218
|
+
d) If the work has interactive user interfaces, each must display
|
|
219
|
+
Appropriate Legal Notices; however, if the Program has interactive
|
|
220
|
+
interfaces that do not display Appropriate Legal Notices, your
|
|
221
|
+
work need not make them do so.
|
|
222
|
+
|
|
223
|
+
A compilation of a covered work with other separate and independent
|
|
224
|
+
works, which are not by their nature extensions of the covered work,
|
|
225
|
+
and which are not combined with it such as to form a larger program,
|
|
226
|
+
in or on a volume of a storage or distribution medium, is called an
|
|
227
|
+
"aggregate" if the compilation and its resulting copyright are not
|
|
228
|
+
used to limit the access or legal rights of the compilation's users
|
|
229
|
+
beyond what the individual works permit. Inclusion of a covered work
|
|
230
|
+
in an aggregate does not cause this License to apply to the other
|
|
231
|
+
parts of the aggregate.
|
|
232
|
+
|
|
233
|
+
6. Conveying Non-Source Forms.
|
|
234
|
+
|
|
235
|
+
You may convey a covered work in object code form under the terms
|
|
236
|
+
of sections 4 and 5, provided that you also convey the
|
|
237
|
+
machine-readable Corresponding Source under the terms of this License,
|
|
238
|
+
in one of these ways:
|
|
239
|
+
|
|
240
|
+
a) Convey the object code in, or embodied in, a physical product
|
|
241
|
+
(including a physical distribution medium), accompanied by the
|
|
242
|
+
Corresponding Source fixed on a durable physical medium
|
|
243
|
+
customarily used for software interchange.
|
|
244
|
+
|
|
245
|
+
b) Convey the object code in, or embodied in, a physical product
|
|
246
|
+
(including a physical distribution medium), accompanied by a
|
|
247
|
+
written offer, valid for at least three years and valid for as
|
|
248
|
+
long as you offer spare parts or customer support for that product
|
|
249
|
+
model, to give anyone who possesses the object code either (1) a
|
|
250
|
+
copy of the Corresponding Source for all the software in the
|
|
251
|
+
product that is covered by this License, on a durable physical
|
|
252
|
+
medium customarily used for software interchange, for a price no
|
|
253
|
+
more than your reasonable cost of physically performing this
|
|
254
|
+
conveying of source, or (2) access to copy the
|
package/README.md
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Neox CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Professional AI code assistant — agent loop, tool use, multi-provider routing.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g @mk-co/neox-cli
|
|
7
|
+
neox --help
|
|
8
|
+
```
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
## Quick start
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
```bash
|
|
13
|
+
neox # 启动交互模式
|
|
14
|
+
neox -p "fix the login bug" # 单次任务
|
|
15
|
+
neox --model gpt-5.4 ... # 指定模型
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Configuration
|
|
19
|
+
|
|
20
|
+
See https://neox.dev/docs for full configuration / authentication / commands.
|
|
21
|
+
|
|
22
|
+
## How this package is structured
|
|
23
|
+
|
|
24
|
+
This is a **thin npm wrapper** (20 KB). The actual CLI is a single-file binary
|
|
25
|
+
shipped via platform-specific optional dependencies:
|
|
26
|
+
|
|
27
|
+
- `@mk-co/neox-cli-darwin-arm64`
|
|
28
|
+
- `@mk-co/neox-cli-darwin-x64`
|
|
29
|
+
- `@mk-co/neox-cli-linux-x64`
|
|
30
|
+
- `@mk-co/neox-cli-linux-arm64`
|
|
31
|
+
- `@mk-co/neox-cli-win32-x64`
|
|
32
|
+
|
|
33
|
+
`npm install` only downloads the binary for your platform (~60-100 MB).
|
|
34
|
+
|
|
35
|
+
Same distribution model as `@anthropic-ai/claude-code`.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
UNLICENSED · proprietary · © MK-CO
|
|
40
|
+
|
|
41
|
+
Source code is closed. Reverse engineering / redistribution of binaries
|
|
42
|
+
prohibited. Contact MK-CO for licensing.
|
package/bin/neox
ADDED
package/cli-wrapper.cjs
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @mk-co/neox-cli · cli-wrapper
|
|
4
|
+
*
|
|
5
|
+
* 主包安装后, bin/neox 是个 symlink → @mk-co/neox-cli-${platform}/neox.
|
|
6
|
+
* 理论上 npm bin shim 直接走 symlink 就行, 不一定需要 wrapper.
|
|
7
|
+
*
|
|
8
|
+
* 但保留这个 wrapper 是给两种 fallback 路径:
|
|
9
|
+
*
|
|
10
|
+
* 1. 用户 main 包当 require('@mk-co/neox-cli') module 用 (尽管罕见) —
|
|
11
|
+
* package.json `"main": "./cli-wrapper.cjs"` 让 require 拿到这个 stub,
|
|
12
|
+
* 不会拿到 binary 然后 SyntaxError.
|
|
13
|
+
*
|
|
14
|
+
* 2. 用户 install 时 postinstall 失败 (e.g. --no-optional), bin/neox 是
|
|
15
|
+
* placeholder, 直接跑 `neox` 时 placeholder script 调本 wrapper 退出
|
|
16
|
+
* + 友好提示.
|
|
17
|
+
*
|
|
18
|
+
* binary 跑起来后, 这个 wrapper 完全不在 critical path, 所以零业务逻辑.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
'use strict';
|
|
22
|
+
|
|
23
|
+
const fs = require('node:fs');
|
|
24
|
+
const path = require('node:path');
|
|
25
|
+
|
|
26
|
+
const SUPPORTED = {
|
|
27
|
+
'darwin-arm64': '@mk-co/neox-cli-darwin-arm64',
|
|
28
|
+
'darwin-x64': '@mk-co/neox-cli-darwin-x64',
|
|
29
|
+
'linux-x64': '@mk-co/neox-cli-linux-x64',
|
|
30
|
+
'linux-arm64': '@mk-co/neox-cli-linux-arm64',
|
|
31
|
+
'win32-x64': '@mk-co/neox-cli-win32-x64',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function findBinary() {
|
|
35
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
36
|
+
const pkgName = SUPPORTED[platformKey];
|
|
37
|
+
if (!pkgName) {
|
|
38
|
+
process.stderr.write(`neox: 不支持当前平台 ${platformKey}.\n`);
|
|
39
|
+
process.stderr.write(`支持的平台: ${Object.keys(SUPPORTED).join(', ')}\n`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`));
|
|
44
|
+
const exeName = process.platform === 'win32' ? 'neox.exe' : 'neox';
|
|
45
|
+
const binary = path.join(pkgRoot, exeName);
|
|
46
|
+
if (fs.existsSync(binary)) return binary;
|
|
47
|
+
} catch { /* fall through */ }
|
|
48
|
+
|
|
49
|
+
process.stderr.write(`neox: 平台子包 ${pkgName} 没装 (可能用了 --no-optional).\n`);
|
|
50
|
+
process.stderr.write(`修复: npm install -g ${pkgName}\n`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* 直接 exec, 跨进程 forward stdio + signals. */
|
|
55
|
+
const { spawn } = require('node:child_process');
|
|
56
|
+
const binary = findBinary();
|
|
57
|
+
const child = spawn(binary, process.argv.slice(2), {
|
|
58
|
+
stdio: 'inherit',
|
|
59
|
+
windowsHide: false,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const passSignal = (sig) => () => {
|
|
63
|
+
try { child.kill(sig); } catch { /* ignore */ }
|
|
64
|
+
};
|
|
65
|
+
process.on('SIGINT', passSignal('SIGINT'));
|
|
66
|
+
process.on('SIGTERM', passSignal('SIGTERM'));
|
|
67
|
+
process.on('SIGHUP', passSignal('SIGHUP'));
|
|
68
|
+
|
|
69
|
+
child.on('exit', (code, sig) => {
|
|
70
|
+
if (sig) {
|
|
71
|
+
/* 让 parent 也以同样 signal 死, shell 才能正确 detect Ctrl-C 退出 */
|
|
72
|
+
process.kill(process.pid, sig);
|
|
73
|
+
} else {
|
|
74
|
+
process.exit(code ?? 0);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
child.on('error', (e) => {
|
|
79
|
+
process.stderr.write(`neox: 无法启动 binary: ${e.message}\n`);
|
|
80
|
+
process.exit(2);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
module.exports = { findBinary };
|
package/install.cjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @mk-co/neox-cli · postinstall
|
|
4
|
+
*
|
|
5
|
+
* npm 装完主包 + 当前 platform 的 optional dep 之后跑这里:
|
|
6
|
+
* · 检测当前 platform = "${process.platform}-${process.arch}"
|
|
7
|
+
* · 找到 @mk-co/neox-cli-${platform} 的 native binary 路径
|
|
8
|
+
* · symlink (Unix) / copy (Windows) 到 ./bin/neox 给 npm bin shim 用
|
|
9
|
+
*
|
|
10
|
+
* 设计跟 @anthropic-ai/claude-code 同套路 — 主包零业务代码, 真 binary 在
|
|
11
|
+
* 平台子包里, 用户 `npm install -g` 时 optional deps 自动只装当前 platform.
|
|
12
|
+
*
|
|
13
|
+
* 失败容错:
|
|
14
|
+
* · platform 不支持 → 退 1 + 友好提示 (列出我们支持的 platforms)
|
|
15
|
+
* · platform 包没装 → 友好提示用户 manual install (常见: 用了 --no-optional)
|
|
16
|
+
*
|
|
17
|
+
* 不抛 throw, 因为 npm postinstall 抛了会让整个 install 显红, 但其实没 fatal.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict';
|
|
21
|
+
|
|
22
|
+
const fs = require('node:fs');
|
|
23
|
+
const path = require('node:path');
|
|
24
|
+
const os = require('node:os');
|
|
25
|
+
|
|
26
|
+
const SUPPORTED = {
|
|
27
|
+
'darwin-arm64': '@mk-co/neox-cli-darwin-arm64',
|
|
28
|
+
'darwin-x64': '@mk-co/neox-cli-darwin-x64',
|
|
29
|
+
'linux-x64': '@mk-co/neox-cli-linux-x64',
|
|
30
|
+
'linux-arm64': '@mk-co/neox-cli-linux-arm64',
|
|
31
|
+
'win32-x64': '@mk-co/neox-cli-win32-x64',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function log(msg) {
|
|
35
|
+
process.stdout.write(`[neox-cli postinstall] ${msg}\n`);
|
|
36
|
+
}
|
|
37
|
+
function warn(msg) {
|
|
38
|
+
process.stderr.write(`[neox-cli postinstall] ⚠ ${msg}\n`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function main() {
|
|
42
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
43
|
+
const pkgName = SUPPORTED[platformKey];
|
|
44
|
+
|
|
45
|
+
if (!pkgName) {
|
|
46
|
+
warn(`不支持当前平台 ${platformKey}.`);
|
|
47
|
+
warn(`支持的平台: ${Object.keys(SUPPORTED).join(', ')}`);
|
|
48
|
+
warn(`你的 neox 命令会找不到, 请联系 MK-CO 支持其他平台.`);
|
|
49
|
+
return; /* 不退 1, 让 npm install 整体成功, 用户跑 neox 时再报错 */
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* 找 platform sub-package 的 binary. node_modules 解析路径取决于安装方式
|
|
53
|
+
* (-g vs 项目级), 用 require.resolve 让 npm 自己决定. */
|
|
54
|
+
let binarySrc;
|
|
55
|
+
try {
|
|
56
|
+
/* 期待: node_modules/@mk-co/neox-cli-${platform}/neox (Unix) or neox.exe (Win) */
|
|
57
|
+
const pkgRoot = path.dirname(require.resolve(`${pkgName}/package.json`));
|
|
58
|
+
const exeName = process.platform === 'win32' ? 'neox.exe' : 'neox';
|
|
59
|
+
binarySrc = path.join(pkgRoot, exeName);
|
|
60
|
+
if (!fs.existsSync(binarySrc)) {
|
|
61
|
+
warn(`平台子包已装但 binary 不在 ${binarySrc} — 可能 publish 出错.`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
} catch (e) {
|
|
65
|
+
warn(`平台子包 ${pkgName} 未安装 (${e.code || 'unknown'}).`);
|
|
66
|
+
warn(`如果你用了 npm install --no-optional / yarn install --ignore-optional,`);
|
|
67
|
+
warn(`手动安装: npm install -g ${pkgName}`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* 创建 bin/neox 指向 platform binary. Unix 用 symlink, Windows 用 copy. */
|
|
72
|
+
const binDir = path.join(__dirname, 'bin');
|
|
73
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
74
|
+
const exeName = process.platform === 'win32' ? 'neox.exe' : 'neox';
|
|
75
|
+
const binDest = path.join(binDir, exeName);
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
if (fs.existsSync(binDest) || fs.lstatSync(binDest).isSymbolicLink?.()) {
|
|
79
|
+
fs.rmSync(binDest, { force: true });
|
|
80
|
+
}
|
|
81
|
+
} catch { /* ignore */ }
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
if (process.platform === 'win32') {
|
|
85
|
+
/* Windows: 不能 symlink (要管理员), 直接 copy */
|
|
86
|
+
fs.copyFileSync(binarySrc, binDest);
|
|
87
|
+
} else {
|
|
88
|
+
fs.symlinkSync(binarySrc, binDest);
|
|
89
|
+
fs.chmodSync(binDest, 0o755);
|
|
90
|
+
}
|
|
91
|
+
log(`installed ${platformKey}: ${path.relative(process.cwd(), binDest)} → ${path.relative(process.cwd(), binarySrc)}`);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
warn(`无法 ${process.platform === 'win32' ? 'copy' : 'symlink'} binary: ${e.message}`);
|
|
94
|
+
warn(`手动 fix: ${process.platform === 'win32' ? 'copy' : 'ln -s'} "${binarySrc}" "${binDest}"`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
try { main(); } catch (e) {
|
|
99
|
+
warn(`unexpected: ${e?.message || String(e)}`);
|
|
100
|
+
/* 仍然 exit 0, 不让 npm install 失败 */
|
|
101
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mk-co/neox-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.1.1",
|
|
4
|
+
"description": "Neox CLI · Professional AI code assistant",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20.0.0"
|
|
8
|
+
},
|
|
9
|
+
"main": "./cli-wrapper.cjs",
|
|
10
|
+
"bin": {
|
|
11
|
+
"neox": "./bin/neox"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin/",
|
|
15
|
+
"install.cjs",
|
|
16
|
+
"cli-wrapper.cjs",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"postinstall": "node install.cjs"
|
|
22
|
+
},
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"@mk-co/neox-cli-darwin-arm64": "2.1.0",
|
|
25
|
+
"@mk-co/neox-cli-darwin-x64": "2.1.0",
|
|
26
|
+
"@mk-co/neox-cli-linux-x64": "2.1.0",
|
|
27
|
+
"@mk-co/neox-cli-linux-arm64": "2.1.0",
|
|
28
|
+
"@mk-co/neox-cli-win32-x64": "2.1.0"
|
|
29
|
+
},
|
|
6
30
|
"publishConfig": {
|
|
7
31
|
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"cli",
|
|
35
|
+
"ai",
|
|
36
|
+
"agent",
|
|
37
|
+
"code-assistant"
|
|
38
|
+
],
|
|
39
|
+
"author": "MK-CO",
|
|
40
|
+
"homepage": "https://neox.dev",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://github.com/mk-co/neox-private"
|
|
8
44
|
}
|
|
9
45
|
}
|