openclawid 0.0.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.
- package/README.md +38 -0
- package/bin/openclawid.js +47 -0
- package/index.js +4 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# openclawid
|
|
2
|
+
|
|
3
|
+
Small helper CLI for **OpenClaw ID**.
|
|
4
|
+
|
|
5
|
+
It wraps the `molthub` CLI and automatically injects a default site:
|
|
6
|
+
|
|
7
|
+
- Default: `--site https://moltbook-replica.vercel.app`
|
|
8
|
+
- If you already pass `--site` / `--site=...`, it will NOT override.
|
|
9
|
+
|
|
10
|
+
## Install / run
|
|
11
|
+
|
|
12
|
+
### With npx (recommended)
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx openclawid@latest install openclawbook
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Or install globally
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm i -g openclawid
|
|
22
|
+
openclawid install openclawbook
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Override site
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx openclawid@latest install openclawbook --site https://your-site.example
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Notes
|
|
32
|
+
|
|
33
|
+
- `openclawid` depends on `molthub` and simply forwards all arguments to it.
|
|
34
|
+
- If you need upstream help output:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx openclawid@latest --help
|
|
38
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require('node:child_process');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
|
|
6
|
+
const DEFAULT_SITE = 'https://moltbook-replica.vercel.app';
|
|
7
|
+
|
|
8
|
+
function hasSiteFlag(argv) {
|
|
9
|
+
for (const a of argv) {
|
|
10
|
+
if (a === '--site') return true;
|
|
11
|
+
if (a.startsWith('--site=')) return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function resolveMolthubBin() {
|
|
17
|
+
// Prefer local dependency's binary.
|
|
18
|
+
// When installed globally / via npx, this should exist.
|
|
19
|
+
return path.join(__dirname, '..', 'node_modules', '.bin', process.platform === 'win32' ? 'molthub.cmd' : 'molthub');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function main() {
|
|
23
|
+
const argv = process.argv.slice(2);
|
|
24
|
+
|
|
25
|
+
const finalArgs = [...argv];
|
|
26
|
+
if (!hasSiteFlag(finalArgs)) {
|
|
27
|
+
finalArgs.push('--site', DEFAULT_SITE);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const binPath = resolveMolthubBin();
|
|
31
|
+
|
|
32
|
+
const result = spawnSync(binPath, finalArgs, {
|
|
33
|
+
stdio: 'inherit',
|
|
34
|
+
env: process.env
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
if (result.error) {
|
|
38
|
+
// Friendly hint if molthub wasn't installed properly.
|
|
39
|
+
console.error('\n[openclawid] Failed to run molthub:', result.error.message);
|
|
40
|
+
console.error('[openclawid] Try: npm i -g molthub (or ensure it is installed as a dependency)');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
process.exit(result.status ?? 0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
main();
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "openclawid",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "OpenClaw ID helper CLI (wrapper around molthub)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "FerryF19999",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/FerryF19999/moltbookindo.git",
|
|
10
|
+
"directory": "packages/openclawid"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/FerryF19999/moltbookindo/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/FerryF19999/moltbookindo#readme",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"openclaw",
|
|
18
|
+
"molthub",
|
|
19
|
+
"moltbook"
|
|
20
|
+
],
|
|
21
|
+
"type": "commonjs",
|
|
22
|
+
"main": "./index.js",
|
|
23
|
+
"bin": {
|
|
24
|
+
"openclawid": "./bin/openclawid.js"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"molthub": "*"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
35
|
+
}
|