@everme/cli 0.1.0-beta.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 +201 -0
- package/README.md +51 -0
- package/package.json +55 -0
- package/scripts/install-wizard.js +60 -0
- package/scripts/install.js +335 -0
- package/scripts/run.js +88 -0
- package/sha256sums.txt +6 -0
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 describing the origin of the Work and
|
|
141
|
+
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 Support. 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 support.
|
|
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 2026 Evermind AI
|
|
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,51 @@
|
|
|
1
|
+
# @everme/cli
|
|
2
|
+
|
|
3
|
+
npm-distributed installer for [EverMe CLI](https://github.com/alwaysday1/everme). Detects your platform on install, downloads the matching pre-built binary from GitHub Releases, verifies its SHA-256 checksum, and exposes it as the `everme` command.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g @everme/cli@beta
|
|
7
|
+
everme --help
|
|
8
|
+
|
|
9
|
+
# or, no install
|
|
10
|
+
npx @everme/cli@beta --version
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## What this package does
|
|
14
|
+
|
|
15
|
+
`@everme/cli` is a thin Node-side installer + runner; the actual CLI is a pre-compiled binary downloaded on first install. On `npm install`:
|
|
16
|
+
|
|
17
|
+
1. Detect platform / arch (darwin/linux/windows × amd64/arm64)
|
|
18
|
+
2. Download the matching archive from `https://github.com/alwaysday1/everme/releases/download/v<version>/evercli_<os>_<arch>.{tar.gz|zip}`
|
|
19
|
+
3. Verify SHA-256 against the `sha256sums.txt` shipped inside this npm package
|
|
20
|
+
4. Extract and place the binary under the package's `bin/` directory
|
|
21
|
+
5. The `everme` shim (`scripts/run.js`) execs that binary with your args
|
|
22
|
+
|
|
23
|
+
If `postinstall` was skipped (some `npx` flows, restricted CI), the installer runs lazily on first invocation.
|
|
24
|
+
|
|
25
|
+
### Mirrors / restricted networks
|
|
26
|
+
|
|
27
|
+
The installer tries download sources in this order:
|
|
28
|
+
|
|
29
|
+
1. `https://github.com/alwaysday1/everme/releases/...` (canonical)
|
|
30
|
+
2. The npm registry's binary mirror path (`<registry>/-/binary/everme-cli/...`), if your `npm_config_registry` is non-default
|
|
31
|
+
3. `https://registry.npmmirror.com/-/binary/everme-cli/...` (always tried as final fallback)
|
|
32
|
+
|
|
33
|
+
The first source to succeed wins. SHA-256 verification runs regardless of source.
|
|
34
|
+
|
|
35
|
+
### Self-hosted backend
|
|
36
|
+
|
|
37
|
+
Point the CLI at your own EverMe gateway:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export EVERCLI_API_BASE_URL=https://memory.acme-internal.com
|
|
41
|
+
everme auth login
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Release channels
|
|
45
|
+
|
|
46
|
+
- `@everme/cli@beta` — pre-release builds
|
|
47
|
+
- `@everme/cli@latest` — stable releases
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
Apache-2.0.
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@everme/cli",
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
4
|
+
"description": "EverMe CLI — npm wrapper that downloads and runs the platform-native evercli binary on first use.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"bin": {
|
|
7
|
+
"everme": "scripts/run.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node scripts/install.js",
|
|
11
|
+
"test": "node --test tests/install.test.js"
|
|
12
|
+
},
|
|
13
|
+
"os": [
|
|
14
|
+
"darwin",
|
|
15
|
+
"linux",
|
|
16
|
+
"win32"
|
|
17
|
+
],
|
|
18
|
+
"cpu": [
|
|
19
|
+
"x64",
|
|
20
|
+
"arm64"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=18.0.0"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"scripts/install.js",
|
|
27
|
+
"scripts/install-wizard.js",
|
|
28
|
+
"scripts/run.js",
|
|
29
|
+
"sha256sums.txt",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"keywords": [
|
|
34
|
+
"evermind",
|
|
35
|
+
"everme",
|
|
36
|
+
"cli",
|
|
37
|
+
"memory",
|
|
38
|
+
"ai",
|
|
39
|
+
"agent"
|
|
40
|
+
],
|
|
41
|
+
"homepage": "https://everme.ai",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/alwaysday1/everme.git",
|
|
45
|
+
"directory": "plugins/cli"
|
|
46
|
+
},
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/alwaysday1/everme/issues"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"registry": "https://registry.npmjs.org"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {}
|
|
55
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright 2026 Evermind AI
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `everme install` wizard. Runs without the binary present, which lets
|
|
7
|
+
* `npx @everme/cli install` work even when the postinstall step was skipped
|
|
8
|
+
* (npx, restricted CI). Responsibilities:
|
|
9
|
+
*
|
|
10
|
+
* 1. Print a short banner so users know what's happening.
|
|
11
|
+
* 2. Ensure the platform-native binary is downloaded (calls install.js
|
|
12
|
+
* with EVERME_CLI_RUN=true to bypass the npx-skip guard).
|
|
13
|
+
* 3. Exec the binary's own `install` subcommand, which is where the real
|
|
14
|
+
* provisioning lives (login, agent token, plugin registration into
|
|
15
|
+
* Claude Code / Cursor / OpenClaw config files).
|
|
16
|
+
*
|
|
17
|
+
* Anything beyond step 3 belongs in the Go binary, not here. Keeping this
|
|
18
|
+
* thin means we don't have to ship feature parity in JS.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const path = require("path");
|
|
22
|
+
const fs = require("fs");
|
|
23
|
+
const { execFileSync } = require("child_process");
|
|
24
|
+
|
|
25
|
+
const NAME = "evercli";
|
|
26
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
27
|
+
const bin = path.join(__dirname, "..", "bin", NAME + ext);
|
|
28
|
+
|
|
29
|
+
const VERSION = require("../package.json").version;
|
|
30
|
+
|
|
31
|
+
console.log(`\n EverMe CLI installer (v${VERSION})`);
|
|
32
|
+
console.log(` ────────────────────────────────────`);
|
|
33
|
+
console.log(` Persistent memory for AI agents.\n`);
|
|
34
|
+
|
|
35
|
+
if (!fs.existsSync(bin)) {
|
|
36
|
+
console.log(` → downloading evercli binary for ${process.platform}-${process.arch}`);
|
|
37
|
+
try {
|
|
38
|
+
execFileSync(process.execPath, [path.join(__dirname, "install.js")], {
|
|
39
|
+
stdio: "inherit",
|
|
40
|
+
env: { ...process.env, EVERME_CLI_RUN: "true" },
|
|
41
|
+
});
|
|
42
|
+
} catch (_) {
|
|
43
|
+
console.error(
|
|
44
|
+
`\n Could not download the evercli binary. See errors above for details.\n` +
|
|
45
|
+
` Once resolved, re-run: npx @everme/cli install\n`,
|
|
46
|
+
);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Hand off to the Go binary's own install/setup flow. If the binary doesn't
|
|
52
|
+
// implement an `install` subcommand yet, surfacing the help text is still a
|
|
53
|
+
// reasonable "first-run" experience.
|
|
54
|
+
try {
|
|
55
|
+
execFileSync(bin, ["install"], { stdio: "inherit" });
|
|
56
|
+
} catch (e) {
|
|
57
|
+
// Exit with the binary's status if it ran but failed; fall back to 1
|
|
58
|
+
// (binary missing, EACCES, etc.).
|
|
59
|
+
process.exit(e.status || 1);
|
|
60
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright 2026 Evermind AI
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* postinstall hook for @everme/cli — downloads, verifies, and extracts the
|
|
7
|
+
* platform-native evercli binary into <pkg>/bin.
|
|
8
|
+
*
|
|
9
|
+
* Conventions match this monorepo's existing goreleaser config and shell
|
|
10
|
+
* installer (cli/.goreleaser.yml, cli/scripts/install.sh):
|
|
11
|
+
*
|
|
12
|
+
* tag cli/vX.Y.Z
|
|
13
|
+
* archive evercli_<os>_<arch>.tar.gz (Unix)
|
|
14
|
+
* evercli_<os>_<arch>.zip (Windows)
|
|
15
|
+
* checksum sha256sums.txt
|
|
16
|
+
*
|
|
17
|
+
* Why curl rather than node:https: matches install.sh, behaves consistently
|
|
18
|
+
* across corporate proxies, and follows redirects without us reimplementing
|
|
19
|
+
* the redirect chain.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const fs = require("fs");
|
|
23
|
+
const path = require("path");
|
|
24
|
+
const os = require("os");
|
|
25
|
+
const crypto = require("crypto");
|
|
26
|
+
const { execFileSync } = require("child_process");
|
|
27
|
+
|
|
28
|
+
// Keep prerelease suffix (e.g. "0.1.0-beta.1") intact — GoReleaser tags
|
|
29
|
+
// match package.json version verbatim, so stripping after `-` would build
|
|
30
|
+
// TAG = cli/v0.1.0 for a 0.1.0-beta.1 publish and 404 against the real
|
|
31
|
+
// cli/v0.1.0-beta.1 release.
|
|
32
|
+
const VERSION = require("../package.json").version;
|
|
33
|
+
const REPO = "alwaysday1/everme";
|
|
34
|
+
const NAME = "evercli";
|
|
35
|
+
|
|
36
|
+
// Allowlist gates the *initial* request URL. curl --location follows redirects
|
|
37
|
+
// (capped by --max-redirs 3) without re-checking the target host. Acceptable
|
|
38
|
+
// because the SHA256 check on the downloaded archive is the primary integrity
|
|
39
|
+
// control; the allowlist is defense-in-depth against obviously wrong URLs.
|
|
40
|
+
const ALLOWED_HOSTS = new Set([
|
|
41
|
+
"github.com",
|
|
42
|
+
"objects.githubusercontent.com",
|
|
43
|
+
"registry.npmmirror.com",
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const PLATFORM_MAP = {
|
|
47
|
+
darwin: "darwin",
|
|
48
|
+
linux: "linux",
|
|
49
|
+
win32: "windows",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const ARCH_MAP = {
|
|
53
|
+
x64: "amd64",
|
|
54
|
+
arm64: "arm64",
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const platform = PLATFORM_MAP[process.platform];
|
|
58
|
+
const arch = ARCH_MAP[process.arch];
|
|
59
|
+
|
|
60
|
+
const isWindows = process.platform === "win32";
|
|
61
|
+
const ext = isWindows ? ".zip" : ".tar.gz";
|
|
62
|
+
const archiveName = `${NAME}_${platform}_${arch}${ext}`;
|
|
63
|
+
|
|
64
|
+
// Tag scheme is bare semver `vX.Y.Z`. The original design used a monorepo
|
|
65
|
+
// prefix `cli/vX.Y.Z`, but goreleaser OSS rejects prefixed tags as invalid
|
|
66
|
+
// semver (the `monorepo.tag_prefix` setting is Pro-only). Since server is
|
|
67
|
+
// deployed separately (not tagged), the cli/ prefix carried no real value.
|
|
68
|
+
const TAG = `v${VERSION}`;
|
|
69
|
+
const GITHUB_URL = `https://github.com/${REPO}/releases/download/${TAG}/${archiveName}`;
|
|
70
|
+
|
|
71
|
+
const binDir = path.join(__dirname, "..", "bin");
|
|
72
|
+
const dest = path.join(binDir, NAME + (isWindows ? ".exe" : ""));
|
|
73
|
+
|
|
74
|
+
function joinUrl(base, suffix) {
|
|
75
|
+
return base.replace(/\/+$/, "") + suffix;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function isValidDownloadBase(raw) {
|
|
79
|
+
try {
|
|
80
|
+
const parsed = new URL(raw);
|
|
81
|
+
return parsed.protocol === "https:" && !!parsed.hostname;
|
|
82
|
+
} catch (_) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function isDefaultNpmjsRegistry(url) {
|
|
88
|
+
try {
|
|
89
|
+
const { hostname } = new URL(url);
|
|
90
|
+
return hostname === "registry.npmjs.org";
|
|
91
|
+
} catch (_) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Build the ordered list of binary mirror URLs to try.
|
|
98
|
+
*
|
|
99
|
+
* 1. npm_config_registry — when the user has set a non-default registry
|
|
100
|
+
* (npmmirror clone, corp Verdaccio, Artifactory), we prepend the
|
|
101
|
+
* derived path. Many proxies don't host /-/binary/<pkg>/..., so we
|
|
102
|
+
* always append the public npmmirror as a final fallback.
|
|
103
|
+
* 2. registry.npmmirror.com — public China mirror, always tried last.
|
|
104
|
+
*
|
|
105
|
+
* The default public npmjs registry is skipped because it doesn't host
|
|
106
|
+
* binaries under /-/binary/...
|
|
107
|
+
*
|
|
108
|
+
* Non-https / malformed npm_config_registry is silently ignored so npm users
|
|
109
|
+
* with http-only internal registries don't have their installs broken.
|
|
110
|
+
*/
|
|
111
|
+
function resolveMirrorUrls(env) {
|
|
112
|
+
const binaryPath = `/-/binary/everme-cli/${TAG}/${archiveName}`;
|
|
113
|
+
const defaultUrl = joinUrl("https://registry.npmmirror.com", binaryPath);
|
|
114
|
+
|
|
115
|
+
const urls = [];
|
|
116
|
+
const registry = (env.npm_config_registry || "").trim();
|
|
117
|
+
if (registry && !isDefaultNpmjsRegistry(registry) && isValidDownloadBase(registry)) {
|
|
118
|
+
const base = new URL(registry);
|
|
119
|
+
urls.push(joinUrl(base.origin + base.pathname, binaryPath));
|
|
120
|
+
}
|
|
121
|
+
if (!urls.includes(defaultUrl)) urls.push(defaultUrl);
|
|
122
|
+
return urls;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function getMirrorUrls(env) {
|
|
126
|
+
const urls = resolveMirrorUrls(env);
|
|
127
|
+
for (const u of urls) ALLOWED_HOSTS.add(new URL(u).hostname);
|
|
128
|
+
return urls;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function assertAllowedHost(url) {
|
|
132
|
+
const { hostname } = new URL(url);
|
|
133
|
+
if (!ALLOWED_HOSTS.has(hostname)) {
|
|
134
|
+
throw new Error(`Download host not allowed: ${hostname}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function download(url, destPath) {
|
|
139
|
+
assertAllowedHost(url);
|
|
140
|
+
const args = [
|
|
141
|
+
"--fail", "--location", "--silent", "--show-error",
|
|
142
|
+
"--connect-timeout", "10", "--max-time", "120",
|
|
143
|
+
"--max-redirs", "3",
|
|
144
|
+
"--output", destPath,
|
|
145
|
+
];
|
|
146
|
+
// On Windows (Schannel), avoid CRYPT_E_REVOCATION_OFFLINE errors when the
|
|
147
|
+
// CRL server is unreachable.
|
|
148
|
+
if (isWindows) args.unshift("--ssl-revoke-best-effort");
|
|
149
|
+
args.push(url);
|
|
150
|
+
execFileSync("curl", args, { stdio: ["ignore", "ignore", "pipe"] });
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function extractZipWindows(archivePath, destDir) {
|
|
154
|
+
const psOpts = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command"];
|
|
155
|
+
const psStdio = ["ignore", "inherit", "inherit"];
|
|
156
|
+
const psEnv = {
|
|
157
|
+
...process.env,
|
|
158
|
+
EVERME_CLI_ARCHIVE: archivePath,
|
|
159
|
+
EVERME_CLI_DEST: destDir,
|
|
160
|
+
};
|
|
161
|
+
try {
|
|
162
|
+
const dotnet =
|
|
163
|
+
"$ErrorActionPreference='Stop';" +
|
|
164
|
+
"Add-Type -AssemblyName System.IO.Compression.FileSystem;" +
|
|
165
|
+
"[System.IO.Compression.ZipFile]::ExtractToDirectory($env:EVERME_CLI_ARCHIVE,$env:EVERME_CLI_DEST)";
|
|
166
|
+
execFileSync("powershell.exe", [...psOpts, dotnet], { stdio: psStdio, env: psEnv });
|
|
167
|
+
} catch (primaryErr) {
|
|
168
|
+
try {
|
|
169
|
+
const cmdlet =
|
|
170
|
+
"$ErrorActionPreference='Stop';" +
|
|
171
|
+
"Expand-Archive -LiteralPath $env:EVERME_CLI_ARCHIVE -DestinationPath $env:EVERME_CLI_DEST -Force";
|
|
172
|
+
execFileSync("powershell.exe", [...psOpts, cmdlet], { stdio: psStdio, env: psEnv });
|
|
173
|
+
} catch (fallbackErr) {
|
|
174
|
+
throw new Error(
|
|
175
|
+
`Failed to extract ${archivePath}. ` +
|
|
176
|
+
`.NET ZipFile attempt: ${primaryErr.message}. ` +
|
|
177
|
+
`Expand-Archive fallback: ${fallbackErr.message}`,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Look up the SHA256 checksum for the archive from sha256sums.txt that ships
|
|
185
|
+
* inside this npm package. If the file is missing (e.g. local dev pack), warn
|
|
186
|
+
* and skip — the goreleaser CI is expected to copy sha256sums.txt before
|
|
187
|
+
* publishing.
|
|
188
|
+
*/
|
|
189
|
+
function getExpectedChecksum(archive, checksumsDir) {
|
|
190
|
+
const dir = checksumsDir || path.join(__dirname, "..");
|
|
191
|
+
const checksumsPath = path.join(dir, "sha256sums.txt");
|
|
192
|
+
if (!fs.existsSync(checksumsPath)) {
|
|
193
|
+
console.error("[WARN] sha256sums.txt not found, skipping checksum verification");
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
const content = fs.readFileSync(checksumsPath, "utf8");
|
|
197
|
+
for (const line of content.split("\n")) {
|
|
198
|
+
const trimmed = line.trim();
|
|
199
|
+
if (!trimmed) continue;
|
|
200
|
+
// sha256sums.txt uses two-space separator: "<hash> <filename>"
|
|
201
|
+
const idx = trimmed.indexOf(" ");
|
|
202
|
+
if (idx === -1) continue;
|
|
203
|
+
const hash = trimmed.slice(0, idx);
|
|
204
|
+
const name = trimmed.slice(idx + 2);
|
|
205
|
+
if (name === archive) return hash;
|
|
206
|
+
}
|
|
207
|
+
throw new Error(`Checksum entry not found for ${archive}`);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function verifyChecksum(archivePath, expectedHash) {
|
|
211
|
+
if (expectedHash === null) return;
|
|
212
|
+
// Stream to keep RSS constant; archives can be ~10MB+.
|
|
213
|
+
const hash = crypto.createHash("sha256");
|
|
214
|
+
const fd = fs.openSync(archivePath, "r");
|
|
215
|
+
try {
|
|
216
|
+
const buf = Buffer.alloc(64 * 1024);
|
|
217
|
+
let bytesRead;
|
|
218
|
+
while ((bytesRead = fs.readSync(fd, buf, 0, buf.length, null)) > 0) {
|
|
219
|
+
hash.update(buf.subarray(0, bytesRead));
|
|
220
|
+
}
|
|
221
|
+
} finally {
|
|
222
|
+
fs.closeSync(fd);
|
|
223
|
+
}
|
|
224
|
+
const actual = hash.digest("hex");
|
|
225
|
+
if (actual.toLowerCase() !== expectedHash.toLowerCase()) {
|
|
226
|
+
throw new Error(
|
|
227
|
+
`[SECURITY] Checksum mismatch for ${path.basename(archivePath)}: ` +
|
|
228
|
+
`expected ${expectedHash} but got ${actual}`,
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function install() {
|
|
234
|
+
const mirrorUrls = getMirrorUrls(process.env);
|
|
235
|
+
const downloadUrls = [GITHUB_URL, ...mirrorUrls];
|
|
236
|
+
|
|
237
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
238
|
+
|
|
239
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "everme-cli-"));
|
|
240
|
+
const archivePath = path.join(tmpDir, archiveName);
|
|
241
|
+
|
|
242
|
+
try {
|
|
243
|
+
// Walk the chain in order; stop at the first success.
|
|
244
|
+
let lastErr;
|
|
245
|
+
let downloaded = false;
|
|
246
|
+
for (const url of downloadUrls) {
|
|
247
|
+
try {
|
|
248
|
+
download(url, archivePath);
|
|
249
|
+
downloaded = true;
|
|
250
|
+
break;
|
|
251
|
+
} catch (e) {
|
|
252
|
+
lastErr = e;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (!downloaded) throw lastErr;
|
|
256
|
+
|
|
257
|
+
const expectedHash = getExpectedChecksum(archiveName);
|
|
258
|
+
verifyChecksum(archivePath, expectedHash);
|
|
259
|
+
|
|
260
|
+
if (isWindows) {
|
|
261
|
+
extractZipWindows(archivePath, tmpDir);
|
|
262
|
+
} else {
|
|
263
|
+
execFileSync("tar", ["-xzf", archivePath, "-C", tmpDir], { stdio: "ignore" });
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const binaryName = NAME + (isWindows ? ".exe" : "");
|
|
267
|
+
const extractedBinary = path.join(tmpDir, binaryName);
|
|
268
|
+
fs.copyFileSync(extractedBinary, dest);
|
|
269
|
+
fs.chmodSync(dest, 0o755);
|
|
270
|
+
console.log(`${NAME} v${VERSION} installed successfully`);
|
|
271
|
+
} finally {
|
|
272
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (require.main === module) {
|
|
277
|
+
if (!platform || !arch) {
|
|
278
|
+
console.error(`Unsupported platform: ${process.platform}-${process.arch}`);
|
|
279
|
+
process.exit(1);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Skip when this script is running from a source-tree workspace install
|
|
283
|
+
// rather than a real install of the published package. Real installs
|
|
284
|
+
// place the package under .../node_modules/@everme/cli/scripts/install.js;
|
|
285
|
+
// workspace dev installs leave __dirname pointing at the source path
|
|
286
|
+
// (e.g. .../plugins/cli/scripts/) since npm symlinks the workspace into
|
|
287
|
+
// node_modules but `__filename` is canonicalized via the symlink target.
|
|
288
|
+
// Without this guard, `npm install` at the repo root fails when no GitHub
|
|
289
|
+
// release exists yet for the in-development version.
|
|
290
|
+
if (!__dirname.includes(`${path.sep}node_modules${path.sep}`)) {
|
|
291
|
+
console.log(
|
|
292
|
+
`[@everme/cli] Skipping binary download during workspace dev install. ` +
|
|
293
|
+
`Set EVERME_CLI_FORCE_INSTALL=1 to override.`,
|
|
294
|
+
);
|
|
295
|
+
if (!process.env.EVERME_CLI_FORCE_INSTALL) process.exit(0);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Explicit opt-out for sandboxed CI / Docker builds where network access
|
|
299
|
+
// isn't available; users who set this know they need to download by hand.
|
|
300
|
+
if (process.env.EVERME_CLI_SKIP_INSTALL) {
|
|
301
|
+
console.log(`[@everme/cli] EVERME_CLI_SKIP_INSTALL=1, skipping download.`);
|
|
302
|
+
process.exit(0);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Under `npx`, npm runs postinstall but the user usually wants a quick
|
|
306
|
+
// throwaway invocation — downloading the binary up-front blocks for ~5s
|
|
307
|
+
// for nothing if their command doesn't actually run the binary
|
|
308
|
+
// (e.g. `npx @everme/cli install` triggers the wizard, which doesn't
|
|
309
|
+
// need the binary). Skip here and let run.js download lazily on first
|
|
310
|
+
// real exec.
|
|
311
|
+
const isNpxPostinstall = process.env.npm_command === "exec" && !process.env.EVERME_CLI_RUN;
|
|
312
|
+
if (isNpxPostinstall) process.exit(0);
|
|
313
|
+
|
|
314
|
+
try {
|
|
315
|
+
install();
|
|
316
|
+
} catch (err) {
|
|
317
|
+
console.error(`Failed to install ${NAME}:`, err.message);
|
|
318
|
+
console.error(
|
|
319
|
+
`\nIf you are behind a firewall or in a restricted network, try one of:\n` +
|
|
320
|
+
` # 1. Use a proxy:\n` +
|
|
321
|
+
` export https_proxy=http://your-proxy:port\n` +
|
|
322
|
+
` npm install -g @everme/cli\n\n` +
|
|
323
|
+
` # 2. Point to a corporate npm mirror that proxies /-/binary/everme-cli/...:\n` +
|
|
324
|
+
` npm install -g @everme/cli --registry=https://your-corp-mirror/\n`,
|
|
325
|
+
);
|
|
326
|
+
process.exit(1);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
module.exports = {
|
|
331
|
+
getExpectedChecksum,
|
|
332
|
+
verifyChecksum,
|
|
333
|
+
assertAllowedHost,
|
|
334
|
+
resolveMirrorUrls,
|
|
335
|
+
};
|
package/scripts/run.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright 2026 Evermind AI
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `everme` bin entry. Three responsibilities:
|
|
7
|
+
*
|
|
8
|
+
* 1. On Windows, recover from a crashed self-update that left the binary
|
|
9
|
+
* renamed to `.old` (evercli is expected to atomically rename
|
|
10
|
+
* <bin> → <bin>.old, write new <bin>, and clear <bin>.old on success;
|
|
11
|
+
* if the process dies between rename and write, we restore here).
|
|
12
|
+
*
|
|
13
|
+
* 2. Route the `install` subcommand to install-wizard.js without exec'ing
|
|
14
|
+
* the binary. The wizard provisions tokens and writes plugin entries
|
|
15
|
+
* into Claude Code / Cursor / OpenClaw config files; it doesn't need
|
|
16
|
+
* the Go binary itself.
|
|
17
|
+
*
|
|
18
|
+
* 3. For every other subcommand, ensure the binary is on disk (lazy
|
|
19
|
+
* download via install.js if missing — covers the npx postinstall-skip
|
|
20
|
+
* path), then exec it with the user's args.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const { execFileSync } = require("child_process");
|
|
24
|
+
const fs = require("fs");
|
|
25
|
+
const path = require("path");
|
|
26
|
+
|
|
27
|
+
const NAME = "evercli";
|
|
28
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
29
|
+
const bin = path.join(__dirname, "..", "bin", NAME + ext);
|
|
30
|
+
const oldBin = bin + ".old";
|
|
31
|
+
|
|
32
|
+
function restoreOldBinary() {
|
|
33
|
+
try {
|
|
34
|
+
if (fs.existsSync(bin)) fs.rmSync(bin, { force: true });
|
|
35
|
+
fs.renameSync(oldBin, bin);
|
|
36
|
+
return true;
|
|
37
|
+
} catch (_) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (process.platform === "win32" && fs.existsSync(oldBin)) {
|
|
43
|
+
if (!fs.existsSync(bin)) {
|
|
44
|
+
restoreOldBinary();
|
|
45
|
+
} else {
|
|
46
|
+
// Both bin and bin.old exist — verify the new one works; if it does,
|
|
47
|
+
// drop bin.old; otherwise restore it.
|
|
48
|
+
try {
|
|
49
|
+
execFileSync(bin, ["--version"], { stdio: "ignore", timeout: 10000 });
|
|
50
|
+
try {
|
|
51
|
+
fs.rmSync(oldBin, { force: true });
|
|
52
|
+
} catch (_) {
|
|
53
|
+
// Best-effort cleanup; the healthy binary still runs.
|
|
54
|
+
}
|
|
55
|
+
} catch (_) {
|
|
56
|
+
restoreOldBinary();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const args = process.argv.slice(2);
|
|
62
|
+
|
|
63
|
+
if (args[0] === "install") {
|
|
64
|
+
// The wizard runs even if the binary is missing — that's the whole point
|
|
65
|
+
// of having it on the JS side.
|
|
66
|
+
require("./install-wizard.js");
|
|
67
|
+
} else {
|
|
68
|
+
if (!fs.existsSync(bin)) {
|
|
69
|
+
try {
|
|
70
|
+
execFileSync(process.execPath, [path.join(__dirname, "install.js")], {
|
|
71
|
+
stdio: "inherit",
|
|
72
|
+
env: { ...process.env, EVERME_CLI_RUN: "true" },
|
|
73
|
+
});
|
|
74
|
+
} catch (_) {
|
|
75
|
+
console.error(
|
|
76
|
+
`\nFailed to auto-install ${NAME} binary.\n` +
|
|
77
|
+
`To fix, run the install script manually:\n` +
|
|
78
|
+
` node "${path.join(__dirname, "install.js")}"\n`,
|
|
79
|
+
);
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
execFileSync(bin, args, { stdio: "inherit" });
|
|
85
|
+
} catch (e) {
|
|
86
|
+
process.exit(e.status || 1);
|
|
87
|
+
}
|
|
88
|
+
}
|
package/sha256sums.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
b351ee7393eefe8eaa96fe2487694e17bd8a44623abf7a6570bd61871623e1b2 evercli_darwin_amd64.tar.gz
|
|
2
|
+
22254cf2e28c6b9a31395b6cfcdb9ae7d6f31698b775a679cdb2a6a1664174c3 evercli_darwin_arm64.tar.gz
|
|
3
|
+
d2505defd953c9367417618b391bfcb7beb08934522e378ba15d3629beb5f7b6 evercli_linux_amd64.tar.gz
|
|
4
|
+
911acb9f4ca8e5f1be7d5ee7a62a7b2bdc7a720a08c80313e1f5f8843a27c5cd evercli_linux_arm64.tar.gz
|
|
5
|
+
9e8ff7f3ba4ca936a891042aace8d05f18424233e42d92d9d7f5715a947ff827 evercli_windows_amd64.zip
|
|
6
|
+
e15a32e8ef17a42671b4288d6e37b85dd3e73ff636f61447864c11af67917ceb evercli_windows_arm64.zip
|