@mamoun-code/cli 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/bin/mamoun.js +22 -3
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -76,7 +76,16 @@ Higher effort uses more of your plan's allowance. `/usage` shows how much you ha
|
|
|
76
76
|
|
|
77
77
|
The beta builds are not yet code-signed.
|
|
78
78
|
- **macOS and Linux:** installs through npm run normally.
|
|
79
|
-
- **Windows with Smart App Control on** (Windows 11): unsigned programs are blocked, and there is no "Run anyway"
|
|
79
|
+
- **Windows with Smart App Control on** (Windows 11): unsigned programs are blocked, and there is no "Run anyway";
|
|
80
|
+
`mamoun` says "Windows blocked …". Use WSL until the builds are signed. In an Ubuntu terminal:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
sudo apt update && sudo apt install -y npm
|
|
84
|
+
sudo npm i -g @mamoun-code/cli
|
|
85
|
+
mamoun login
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Your Windows folders are under `/mnt/c/...` there.
|
|
80
89
|
- **Windows with SmartScreen:** if it warns about `mamoun.exe`, choose **More info**, then **Run anyway**.
|
|
81
90
|
|
|
82
91
|
## Update, log out, uninstall
|
package/bin/mamoun.js
CHANGED
|
@@ -35,18 +35,37 @@ function binaryPath(platform, arch, resolve) {
|
|
|
35
35
|
return path.join(path.dirname(manifest), "bin", platform === "win32" ? "mamoun.exe" : "mamoun");
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
// The codes Windows gives when it refuses to run a program, such as an unsigned one under Smart App Control.
|
|
39
|
+
const WINDOWS_BLOCKED = new Set(["UNKNOWN", "EACCES", "EPERM"]);
|
|
40
|
+
|
|
41
|
+
// startFailure is what to tell the developer when the binary could not be started.
|
|
42
|
+
function startFailure(binary, err, platform) {
|
|
43
|
+
if (platform === "win32" && WINDOWS_BLOCKED.has(err.code)) {
|
|
44
|
+
return `Windows blocked ${binary}. Smart App Control only runs signed programs, and this beta build is not `
|
|
45
|
+
+ `signed yet. Use Mamoun Code in WSL for now: inside Ubuntu, run "npm i -g @mamoun-code/cli".`;
|
|
46
|
+
}
|
|
47
|
+
return `Could not start ${binary}: ${err.message}. Reinstall with "npm i -g @mamoun-code/cli".`;
|
|
48
|
+
}
|
|
49
|
+
|
|
38
50
|
// launch runs the binary on this terminal with these arguments, and ends this process the way the binary ended.
|
|
39
51
|
// Ctrl+C already reaches the binary, because the terminal signals the whole process group, so SIGINT only keeps this
|
|
40
52
|
// process alive to pass the exit code on; forwarding it would be a second Ctrl+C, which force-quits. SIGTERM and SIGHUP
|
|
41
53
|
// are sent to this process alone, so they are passed on.
|
|
42
54
|
function launch(binary, args) {
|
|
43
|
-
|
|
55
|
+
let child;
|
|
56
|
+
try {
|
|
57
|
+
child = spawn(binary, args, { stdio: "inherit" });
|
|
58
|
+
} catch (err) {
|
|
59
|
+
// Windows refuses a blocked program here, at once, rather than through the "error" event.
|
|
60
|
+
console.error(startFailure(binary, err, process.platform));
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
44
63
|
process.on("SIGINT", () => {});
|
|
45
64
|
for (const signal of ["SIGTERM", "SIGHUP"]) {
|
|
46
65
|
process.on(signal, () => child.kill(signal));
|
|
47
66
|
}
|
|
48
67
|
child.on("error", (err) => {
|
|
49
|
-
console.error(
|
|
68
|
+
console.error(startFailure(binary, err, process.platform));
|
|
50
69
|
process.exit(1);
|
|
51
70
|
});
|
|
52
71
|
child.on("exit", (code, signal) => {
|
|
@@ -70,6 +89,6 @@ function main() {
|
|
|
70
89
|
launch(binary, process.argv.slice(2));
|
|
71
90
|
}
|
|
72
91
|
|
|
73
|
-
module.exports = { packageFor, binaryPath, launch, PACKAGES };
|
|
92
|
+
module.exports = { packageFor, binaryPath, launch, startFailure, PACKAGES };
|
|
74
93
|
|
|
75
94
|
if (require.main === module) main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mamoun-code/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Mamoun Code: an AI coding agent in your terminal.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mamoun": "bin/mamoun.js"
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"optionalDependencies": {
|
|
13
|
-
"@mamoun-code/cli-darwin-x64": "0.
|
|
14
|
-
"@mamoun-code/cli-darwin-arm64": "0.
|
|
15
|
-
"@mamoun-code/cli-linux-x64": "0.
|
|
16
|
-
"@mamoun-code/cli-linux-arm64": "0.
|
|
17
|
-
"@mamoun-code/cli-win32-x64": "0.
|
|
18
|
-
"@mamoun-code/cli-win32-arm64": "0.
|
|
13
|
+
"@mamoun-code/cli-darwin-x64": "0.2.0",
|
|
14
|
+
"@mamoun-code/cli-darwin-arm64": "0.2.0",
|
|
15
|
+
"@mamoun-code/cli-linux-x64": "0.2.0",
|
|
16
|
+
"@mamoun-code/cli-linux-arm64": "0.2.0",
|
|
17
|
+
"@mamoun-code/cli-win32-x64": "0.2.0",
|
|
18
|
+
"@mamoun-code/cli-win32-arm64": "0.2.0"
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|