@samva/cli 0.1.0 → 0.1.2
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/AGENTS.md +4 -2
- package/README.md +17 -6
- package/bin/samva.cjs +57 -0
- package/dist/bin.mjs +61636 -0
- package/package.json +21 -23
- package/bin/samva +0 -3
- package/install.cjs +0 -35
package/AGENTS.md
CHANGED
|
@@ -10,5 +10,7 @@ loads the project's installed authoring toolchain so its compiler and editor ver
|
|
|
10
10
|
by the project lockfile. Template authoring commands require Node.js 22 or newer; other CLI commands
|
|
11
11
|
remain self-contained.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
`@samva/cli` ships the JavaScript implementation and its runtime dependencies. Its launcher prefers
|
|
14
|
+
the matching platform-specific `@samva/cli-*` executable and falls back to the packaged JavaScript
|
|
15
|
+
CLI through Bun when npm omits optional dependencies. Depend on `@samva/cli`, never a native
|
|
16
|
+
artifact directly.
|
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# @samva/cli
|
|
2
2
|
|
|
3
|
-
The `samva` CLI sends and operates email from a terminal.
|
|
4
|
-
|
|
5
|
-
the project's `@samva/vite`
|
|
3
|
+
The `samva` CLI sends and operates email from a terminal. The npm package includes
|
|
4
|
+
the JavaScript implementation and selects a self-contained native executable when
|
|
5
|
+
one is available. Template authoring commands run the project's `@samva/vite`
|
|
6
|
+
toolchain under Node.js 22 or newer.
|
|
6
7
|
|
|
7
8
|
## Install
|
|
8
9
|
|
|
@@ -11,8 +12,10 @@ npm install -g @samva/cli
|
|
|
11
12
|
samva --help
|
|
12
13
|
```
|
|
13
14
|
|
|
14
|
-
The npm package
|
|
15
|
-
|
|
15
|
+
The npm package prefers the matching macOS or Linux executable. If npm omits
|
|
16
|
+
optional dependencies, the same command falls back to the packaged JavaScript
|
|
17
|
+
implementation when Bun is installed. Compiled binaries are also available from
|
|
18
|
+
[GitHub releases](https://github.com/AryaLabsHQ/samva/releases).
|
|
16
19
|
|
|
17
20
|
## Shell completions
|
|
18
21
|
|
|
@@ -70,7 +73,7 @@ samva --profile local email doctor
|
|
|
70
73
|
|
|
71
74
|
The profile resolves as `--profile`, then `SAMVA_PROFILE`, then the active profile, then `default`.
|
|
72
75
|
The API URL resolves as `--api-url`, then `SAMVA_API_URL`, then the profile target. `local` targets
|
|
73
|
-
`
|
|
76
|
+
the Portless API origin `https://api.samva.localhost`. `production` targets `https://api.samva.dev`.
|
|
74
77
|
|
|
75
78
|
## Common operations
|
|
76
79
|
|
|
@@ -100,6 +103,14 @@ samva messages events <message-id> --json
|
|
|
100
103
|
|
|
101
104
|
# Inspect configuration and remote email state without mutating it.
|
|
102
105
|
samva email doctor --json
|
|
106
|
+
|
|
107
|
+
# Read and set organization open/click tracking defaults.
|
|
108
|
+
samva email tracking defaults get
|
|
109
|
+
samva email tracking defaults set --opens on --clicks off
|
|
110
|
+
|
|
111
|
+
# Pull and push the organization email design kit as Tailwind `@theme` CSS.
|
|
112
|
+
samva email design pull
|
|
113
|
+
samva email design push --dry-run
|
|
103
114
|
```
|
|
104
115
|
|
|
105
116
|
## Template projects
|
package/bin/samva.cjs
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require("node:child_process");
|
|
4
|
+
const { existsSync } = require("node:fs");
|
|
5
|
+
const { dirname, join } = require("node:path");
|
|
6
|
+
|
|
7
|
+
const forwardedSignals = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
8
|
+
|
|
9
|
+
const run = (command, args) => {
|
|
10
|
+
const child = spawn(command, args, { stdio: "inherit" });
|
|
11
|
+
const forwarders = new Map();
|
|
12
|
+
|
|
13
|
+
for (const signal of forwardedSignals) {
|
|
14
|
+
const forward = () => child.kill(signal);
|
|
15
|
+
forwarders.set(signal, forward);
|
|
16
|
+
process.on(signal, forward);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
child.on("error", (error) => {
|
|
20
|
+
if (error.code === "ENOENT" && command === "bun") {
|
|
21
|
+
console.error(
|
|
22
|
+
"samva: the native executable is unavailable and Bun is not installed; reinstall @samva/cli with optional dependencies or install Bun",
|
|
23
|
+
);
|
|
24
|
+
} else {
|
|
25
|
+
console.error(`samva: ${error.message}`);
|
|
26
|
+
}
|
|
27
|
+
process.exitCode = 1;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
child.on("exit", (code, signal) => {
|
|
31
|
+
for (const [forwardedSignal, forward] of forwarders) {
|
|
32
|
+
process.removeListener(forwardedSignal, forward);
|
|
33
|
+
}
|
|
34
|
+
if (signal) process.kill(process.pid, signal);
|
|
35
|
+
else process.exitCode = code ?? 1;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const target = `${process.platform}-${process.arch}`;
|
|
40
|
+
const packageName = `@samva/cli-${target}`;
|
|
41
|
+
let nativeExecutable;
|
|
42
|
+
|
|
43
|
+
// oxlint-disable-next-line samva/no-try-catch-or-throw -- CommonJS launcher probes an optional platform package before using the Bun fallback
|
|
44
|
+
try {
|
|
45
|
+
const manifest = require.resolve(`${packageName}/package.json`, { paths: [__dirname] });
|
|
46
|
+
const candidate = join(dirname(manifest), "samva");
|
|
47
|
+
if (existsSync(candidate)) nativeExecutable = candidate;
|
|
48
|
+
} catch {
|
|
49
|
+
// npm may omit optional dependencies. The JavaScript distribution below is
|
|
50
|
+
// the supported fallback rather than an installation-time failure.
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (nativeExecutable) {
|
|
54
|
+
run(nativeExecutable, process.argv.slice(2));
|
|
55
|
+
} else {
|
|
56
|
+
run("bun", [join(__dirname, "..", "dist", "bin.mjs"), ...process.argv.slice(2)]);
|
|
57
|
+
}
|