@remnic/cli 1.0.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/bin/engram.cjs +56 -0
- package/bin/remnic.cjs +44 -0
- package/dist/index.js +1581 -0
- package/package.json +45 -0
- package/templates/launchd/ai.remnic.daemon.plist +43 -0
- package/templates/systemd/remnic.service +17 -0
package/bin/engram.cjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* engram CLI binary entry point.
|
|
4
|
+
*
|
|
5
|
+
* Legacy compatibility wrapper for the canonical remnic CLI.
|
|
6
|
+
*/
|
|
7
|
+
const { resolve } = require("node:path");
|
|
8
|
+
const { existsSync } = require("node:fs");
|
|
9
|
+
const { execFileSync } = require("node:child_process");
|
|
10
|
+
|
|
11
|
+
const cwd = __dirname;
|
|
12
|
+
const distEntry = resolve(cwd, "../dist/index.js");
|
|
13
|
+
const srcEntry = resolve(cwd, "../src/index.ts");
|
|
14
|
+
|
|
15
|
+
// Respect user color preferences: only force color if not explicitly disabled
|
|
16
|
+
const colorEnv = {};
|
|
17
|
+
if (!process.env.NO_COLOR && process.env.FORCE_COLOR === undefined) {
|
|
18
|
+
colorEnv.FORCE_COLOR = "1";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
if (existsSync(distEntry)) {
|
|
23
|
+
// Production: run built ESM output with Node directly
|
|
24
|
+
execFileSync(
|
|
25
|
+
process.execPath,
|
|
26
|
+
[distEntry, ...process.argv.slice(2)],
|
|
27
|
+
{
|
|
28
|
+
stdio: "inherit",
|
|
29
|
+
env: { ...process.env, REMNIC_CLI_BIN: "1", ENGRAM_CLI_BIN: "1", ...colorEnv },
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
} else {
|
|
33
|
+
// Development: run TypeScript source via tsx
|
|
34
|
+
const tsxCandidates = [
|
|
35
|
+
resolve(cwd, "../node_modules/.bin/tsx"),
|
|
36
|
+
resolve(cwd, "../../../node_modules/.bin/tsx"),
|
|
37
|
+
];
|
|
38
|
+
const tsxCmd = tsxCandidates.find((c) => existsSync(c)) || "tsx";
|
|
39
|
+
execFileSync(
|
|
40
|
+
tsxCmd,
|
|
41
|
+
[srcEntry, ...process.argv.slice(2)],
|
|
42
|
+
{
|
|
43
|
+
stdio: "inherit",
|
|
44
|
+
env: { ...process.env, REMNIC_CLI_BIN: "1", ENGRAM_CLI_BIN: "1", ...colorEnv },
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
} catch (err) {
|
|
49
|
+
// execFileSync throws on non-zero exit — propagate the child's exit code.
|
|
50
|
+
if (err.status != null) {
|
|
51
|
+
process.exitCode = err.status;
|
|
52
|
+
} else {
|
|
53
|
+
process.stderr.write(`Fatal: ${err.message}\n`);
|
|
54
|
+
process.exitCode = 1;
|
|
55
|
+
}
|
|
56
|
+
}
|
package/bin/remnic.cjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* remnic CLI binary entry point.
|
|
4
|
+
*
|
|
5
|
+
* Canonical wrapper for the built ESM CLI entry point.
|
|
6
|
+
*/
|
|
7
|
+
const { resolve } = require("node:path");
|
|
8
|
+
const { existsSync } = require("node:fs");
|
|
9
|
+
const { execFileSync } = require("node:child_process");
|
|
10
|
+
|
|
11
|
+
const cwd = __dirname;
|
|
12
|
+
const distEntry = resolve(cwd, "../dist/index.js");
|
|
13
|
+
const srcEntry = resolve(cwd, "../src/index.ts");
|
|
14
|
+
|
|
15
|
+
const colorEnv = {};
|
|
16
|
+
if (!process.env.NO_COLOR && process.env.FORCE_COLOR === undefined) {
|
|
17
|
+
colorEnv.FORCE_COLOR = "1";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
if (existsSync(distEntry)) {
|
|
22
|
+
execFileSync(process.execPath, [distEntry, ...process.argv.slice(2)], {
|
|
23
|
+
stdio: "inherit",
|
|
24
|
+
env: { ...process.env, REMNIC_CLI_BIN: "1", ...colorEnv },
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
const tsxCandidates = [
|
|
28
|
+
resolve(cwd, "../node_modules/.bin/tsx"),
|
|
29
|
+
resolve(cwd, "../../../node_modules/.bin/tsx"),
|
|
30
|
+
];
|
|
31
|
+
const tsxCmd = tsxCandidates.find((c) => existsSync(c)) || "tsx";
|
|
32
|
+
execFileSync(tsxCmd, [srcEntry, ...process.argv.slice(2)], {
|
|
33
|
+
stdio: "inherit",
|
|
34
|
+
env: { ...process.env, REMNIC_CLI_BIN: "1", ...colorEnv },
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
} catch (err) {
|
|
38
|
+
if (err.status != null) {
|
|
39
|
+
process.exitCode = err.status;
|
|
40
|
+
} else {
|
|
41
|
+
process.stderr.write(`Fatal: ${err.message}\n`);
|
|
42
|
+
process.exitCode = 1;
|
|
43
|
+
}
|
|
44
|
+
}
|