@lorehq/cli 0.1.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/lore.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require("child_process");
4
+ const { join } = require("path");
5
+
6
+ const PLATFORMS = {
7
+ "linux-x64": "@lorehq/cli-linux-x64",
8
+ "linux-arm64": "@lorehq/cli-linux-arm64",
9
+ "darwin-x64": "@lorehq/cli-darwin-x64",
10
+ "darwin-arm64": "@lorehq/cli-darwin-arm64",
11
+ "win32-x64": "@lorehq/cli-win32-x64",
12
+ "win32-arm64": "@lorehq/cli-win32-arm64",
13
+ };
14
+
15
+ const key = `${process.platform}-${process.arch}`;
16
+ const pkg = PLATFORMS[key];
17
+ if (!pkg) {
18
+ console.error(`Unsupported platform: ${key}`);
19
+ process.exit(1);
20
+ }
21
+
22
+ let bin;
23
+ try {
24
+ bin = join(require.resolve(`${pkg}/package.json`), "..", "lore");
25
+ } catch {
26
+ console.error(`Platform package ${pkg} not installed.`);
27
+ console.error("Try reinstalling: npm i -g @lorehq/cli");
28
+ process.exit(1);
29
+ }
30
+
31
+ if (process.platform === "win32") bin += ".exe";
32
+
33
+ try {
34
+ execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
35
+ } catch (e) {
36
+ process.exit(e.status ?? 1);
37
+ }
Binary file
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@lorehq/cli",
3
+ "version": "0.1.0",
4
+ "description": "Lore CLI — agentic coding, unified",
5
+ "bin": {
6
+ "lore": "bin/lore.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node scripts/postinstall.js"
10
+ },
11
+ "optionalDependencies": {
12
+ "@lorehq/cli-linux-x64": "0.1.0",
13
+ "@lorehq/cli-linux-arm64": "0.1.0",
14
+ "@lorehq/cli-darwin-x64": "0.1.0",
15
+ "@lorehq/cli-darwin-arm64": "0.1.0",
16
+ "@lorehq/cli-win32-x64": "0.1.0",
17
+ "@lorehq/cli-win32-arm64": "0.1.0"
18
+ },
19
+ "keywords": ["lore", "cli", "agent", "ai", "harness", "coding-agent"],
20
+ "license": "Apache-2.0",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/lorehq/lore"
24
+ },
25
+ "engines": {
26
+ "node": ">=18"
27
+ }
28
+ }
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Postinstall: bootstrap global directory and install the default bundle.
4
+ // No shipped files — everything is fetched via the binary's own commands.
5
+
6
+ const { execSync } = require("child_process");
7
+
8
+ const sudoUser = process.env.SUDO_USER;
9
+ const isRoot = process.getuid && process.getuid() === 0;
10
+
11
+ function run(cmd) {
12
+ if (isRoot && sudoUser) {
13
+ execSync(`su - ${sudoUser} -c "${cmd}"`, { stdio: "pipe", timeout: 30000 });
14
+ } else {
15
+ execSync(cmd, { stdio: "pipe", timeout: 30000 });
16
+ }
17
+ }
18
+
19
+ try {
20
+ // Bootstrap ~/.config/lore/ — dirs, harness seeds, examples
21
+ run("lore version");
22
+
23
+ // Install default bundle (lore-os)
24
+ run("lore bundle install lore-os --url https://github.com/lorehq/lore-os.git");
25
+ } catch (e) {
26
+ // Binary not yet in PATH during install — will bootstrap on first user command
27
+ }