@mamoun-code/cli 0.0.0-stage → 0.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.
Files changed (3) hide show
  1. package/README.md +93 -2
  2. package/bin/mamoun.js +75 -0
  3. package/package.json +23 -4
package/README.md CHANGED
@@ -1,3 +1,94 @@
1
- # Temporary Holding Version
1
+ # Mamoun Code
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An AI coding agent in your terminal. It reads your project, edits files, and runs commands with your approval.
4
+
5
+ Mamoun Code is in a private beta. You need a Mamoun account that is on the beta list.
6
+
7
+ ## Install
8
+
9
+ You need Node.js 18 or newer.
10
+
11
+ ```
12
+ npm i -g @mamoun-code/cli
13
+ ```
14
+
15
+ This installs the `mamoun` command and the binary for your system: macOS, Linux or Windows, on x64 or arm64.
16
+
17
+ ## Log in
18
+
19
+ ```
20
+ mamoun login
21
+ ```
22
+
23
+ Mamoun shows a link and a code. Open the link, check that the code matches, and approve. The terminal then says `Logged in.`
24
+
25
+ ## Your first task
26
+
27
+ In a project folder, run `mamoun` and type what you want:
28
+
29
+ ```
30
+ mamoun
31
+ > Why does the cart test fail? Fix it.
32
+ ```
33
+
34
+ Mamoun shows each file edit and command before it happens and waits for your approval.
35
+
36
+ For one task without the interactive screen:
37
+
38
+ ```
39
+ mamoun -p "Explain what src/cart.js does"
40
+ mamoun -p "Fix the failing test in test/cart.test.js" --allow-edits
41
+ ```
42
+
43
+ In this mode, Mamoun edits files only when you pass `--allow-edits`. It runs only the commands you allow:
44
+ - with an always-allow rule saved in the interactive screen;
45
+ - with `--allow-command "npm test"` for this run only.
46
+
47
+ ## Effort
48
+
49
+ `--effort low|medium|high`, or `/effort` in the interactive screen, sets how hard Mamoun works on a task. The default is medium.
50
+ - **Low** is quick and cheap, for small questions.
51
+ - **High** reads more and thinks longer, for hard bugs.
52
+
53
+ Higher effort uses more of your plan's allowance. `/usage` shows how much you have used.
54
+
55
+ ## Useful commands
56
+
57
+ | You type | What it does |
58
+ |---|---|
59
+ | `@path/to/file` | Attach a file or folder to your message |
60
+ | `!npm test` | Run a command yourself; Mamoun sees its output |
61
+ | `/undo` | Undo Mamoun's latest file edit |
62
+ | `/compact` | Summarize the conversation so far, to keep long sessions fast |
63
+ | `/resume` | Continue an earlier session in this project (or start with `mamoun --resume`) |
64
+ | `/usage` | Show how much of your allowance you have used |
65
+ | `/help` | List every command |
66
+
67
+ `mamoun --continue` reopens the latest session in this project.
68
+
69
+ ## What is stored where
70
+
71
+ - **On the Mamoun server:** only usage numbers, such as how many steps ran, at which effort, and what they cost. Never your files, prompts, answers or command output.
72
+ - **On your machine:** your conversations, in `~/.mamoun`. Old sessions are cleaned up automatically.
73
+ - Mamoun never reads files your `.gitignore` or `.mamounignore` excludes, or files that look like secrets.
74
+
75
+ ## Unsigned builds
76
+
77
+ The beta builds are not yet code-signed.
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". Use WSL, or wait for signed builds.
80
+ - **Windows with SmartScreen:** if it warns about `mamoun.exe`, choose **More info**, then **Run anyway**.
81
+
82
+ ## Update, log out, uninstall
83
+
84
+ ```
85
+ npm i -g @mamoun-code/cli@latest # update; Mamoun also tells you once a day when a newer version exists
86
+ mamoun logout # log out on this machine
87
+ npm rm -g @mamoun-code/cli # uninstall
88
+ ```
89
+
90
+ You can also disconnect a machine from the web app: open the account menu at the foot of the sidebar and choose **Connected CLIs**.
91
+
92
+ ## Feedback
93
+
94
+ Send bugs and ideas to your beta contact. For a bug, include what you ran and what happened. If you can, also run it again with `--debug` and attach the log it names. The log holds ids and sizes, never file contents.
package/bin/mamoun.js ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ // Runs the Mamoun Code binary from the platform package npm installed for this machine.
4
+
5
+ const { spawn } = require("node:child_process");
6
+ const path = require("node:path");
7
+
8
+ // Each platform and CPU npm reports, and the package that holds its binary. Kept in step with platforms.mjs by a test.
9
+ const PACKAGES = {
10
+ "darwin-x64": "@mamoun-code/cli-darwin-x64",
11
+ "darwin-arm64": "@mamoun-code/cli-darwin-arm64",
12
+ "linux-x64": "@mamoun-code/cli-linux-x64",
13
+ "linux-arm64": "@mamoun-code/cli-linux-arm64",
14
+ "win32-x64": "@mamoun-code/cli-win32-x64",
15
+ "win32-arm64": "@mamoun-code/cli-win32-arm64",
16
+ };
17
+
18
+ function packageFor(platform, arch) {
19
+ return Object.hasOwn(PACKAGES, `${platform}-${arch}`) ? PACKAGES[`${platform}-${arch}`] : undefined;
20
+ }
21
+
22
+ function binaryPath(platform, arch, resolve) {
23
+ const target = `${platform}-${arch}`;
24
+ const name = packageFor(platform, arch);
25
+ if (!name) {
26
+ throw new Error(`Mamoun Code has no build for ${target}. It runs on macOS, Linux and Windows, on x64 and arm64.`);
27
+ }
28
+ let manifest;
29
+ try {
30
+ manifest = resolve(`${name}/package.json`);
31
+ } catch {
32
+ throw new Error(`The Mamoun Code binary for ${target} (${name}) is not installed. npm may have skipped optional `
33
+ + `dependencies: reinstall with "npm i -g @mamoun-code/cli", without --omit=optional or --no-optional.`);
34
+ }
35
+ return path.join(path.dirname(manifest), "bin", platform === "win32" ? "mamoun.exe" : "mamoun");
36
+ }
37
+
38
+ // launch runs the binary on this terminal with these arguments, and ends this process the way the binary ended.
39
+ // Ctrl+C already reaches the binary, because the terminal signals the whole process group, so SIGINT only keeps this
40
+ // process alive to pass the exit code on; forwarding it would be a second Ctrl+C, which force-quits. SIGTERM and SIGHUP
41
+ // are sent to this process alone, so they are passed on.
42
+ function launch(binary, args) {
43
+ const child = spawn(binary, args, { stdio: "inherit" });
44
+ process.on("SIGINT", () => {});
45
+ for (const signal of ["SIGTERM", "SIGHUP"]) {
46
+ process.on(signal, () => child.kill(signal));
47
+ }
48
+ child.on("error", (err) => {
49
+ console.error(`Could not start ${binary}: ${err.message}`);
50
+ process.exit(1);
51
+ });
52
+ child.on("exit", (code, signal) => {
53
+ if (signal) {
54
+ process.removeAllListeners(signal);
55
+ process.kill(process.pid, signal);
56
+ return;
57
+ }
58
+ process.exit(code ?? 1);
59
+ });
60
+ }
61
+
62
+ function main() {
63
+ let binary;
64
+ try {
65
+ binary = binaryPath(process.platform, process.arch, require.resolve);
66
+ } catch (err) {
67
+ console.error(err.message);
68
+ process.exit(1);
69
+ }
70
+ launch(binary, process.argv.slice(2));
71
+ }
72
+
73
+ module.exports = { packageFor, binaryPath, launch, PACKAGES };
74
+
75
+ if (require.main === module) main();
package/package.json CHANGED
@@ -1,6 +1,25 @@
1
1
  {
2
2
  "name": "@mamoun-code/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Mamoun Code: an AI coding agent in your terminal.",
5
+ "bin": {
6
+ "mamoun": "bin/mamoun.js"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "README.md"
11
+ ],
12
+ "optionalDependencies": {
13
+ "@mamoun-code/cli-darwin-x64": "0.1.1",
14
+ "@mamoun-code/cli-darwin-arm64": "0.1.1",
15
+ "@mamoun-code/cli-linux-x64": "0.1.1",
16
+ "@mamoun-code/cli-linux-arm64": "0.1.1",
17
+ "@mamoun-code/cli-win32-x64": "0.1.1",
18
+ "@mamoun-code/cli-win32-arm64": "0.1.1"
19
+ },
20
+ "engines": {
21
+ "node": ">=18"
22
+ },
23
+ "license": "UNLICENSED",
24
+ "homepage": "https://mamoun.app"
25
+ }