@lobehub/cli 0.0.1-canary.9 → 0.0.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/README.md +55 -0
- package/dist/buffer-crc32-BlUV1nEz.js +342 -0
- package/dist/doc-CR0Zm5t8.js +4144 -0
- package/dist/docx-73xqMWN6.js +33097 -0
- package/dist/excel-3NB56vnT.js +23451 -0
- package/dist/index.js +30387 -6995
- package/dist/node-BbXtxEF5.js +48 -0
- package/dist/pdf-B5Ukgxfs.js +108386 -0
- package/dist/pptx-DwZ8X2Hk.js +9929 -0
- package/dist/text-LU5pflEU.js +59 -0
- package/man/man1/lh.1 +166 -0
- package/man/man1/lobe.1 +1 -0
- package/man/man1/lobehub.1 +1 -0
- package/package.json +27 -21
- package/dist/chunk-LMMQX4CK.js +0 -49
- package/dist/chunk-OHUXGRBO.js +0 -66
- package/dist/chunk-SIPW4ILE.js +0 -374
- package/dist/doc-GP5GLKH3.js +0 -4361
- package/dist/docx-WBQXROXK.js +0 -31061
- package/dist/excel-7OIQJBE4.js +0 -26983
- package/dist/pdf-DR5MENXH.js +0 -94752
- package/dist/pptx-TR7ZMKBG.js +0 -10784
- package/dist/text-6IT6PEWE.js +0 -60
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { s as __toESM, t as require_src } from "./index.js";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
const log = (0, (/* @__PURE__ */ __toESM(require_src())).default)("file-loaders:text");
|
|
5
|
+
/**
|
|
6
|
+
* Loader for loading plain text files.
|
|
7
|
+
*/
|
|
8
|
+
var TextLoader = class {
|
|
9
|
+
async loadPages(filePath) {
|
|
10
|
+
log("Loading text file:", filePath);
|
|
11
|
+
try {
|
|
12
|
+
const fileContent = await readFile(filePath, "utf8");
|
|
13
|
+
log("Text file loaded successfully, size:", fileContent.length, "bytes");
|
|
14
|
+
const lineCount = fileContent.split("\n").length;
|
|
15
|
+
const charCount = fileContent.length;
|
|
16
|
+
log("Text file stats:", {
|
|
17
|
+
charCount,
|
|
18
|
+
lineCount
|
|
19
|
+
});
|
|
20
|
+
const page = {
|
|
21
|
+
charCount,
|
|
22
|
+
lineCount,
|
|
23
|
+
metadata: {
|
|
24
|
+
lineNumberEnd: lineCount,
|
|
25
|
+
lineNumberStart: 1
|
|
26
|
+
},
|
|
27
|
+
pageContent: fileContent
|
|
28
|
+
};
|
|
29
|
+
log("Text page created successfully");
|
|
30
|
+
return [page];
|
|
31
|
+
} catch (e) {
|
|
32
|
+
const error = e;
|
|
33
|
+
log("Error encountered while loading text file");
|
|
34
|
+
console.error(`Error loading text file ${filePath}: ${error.message}`);
|
|
35
|
+
const errorPage = {
|
|
36
|
+
charCount: 0,
|
|
37
|
+
lineCount: 0,
|
|
38
|
+
metadata: { error: `Failed to load text file: ${error.message}` },
|
|
39
|
+
pageContent: ""
|
|
40
|
+
};
|
|
41
|
+
log("Created error page for failed text file loading");
|
|
42
|
+
return [errorPage];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* For plain text, simply concatenate the content of all pages.
|
|
47
|
+
* (Although TextLoader typically has only one page, this maintains interface consistency)
|
|
48
|
+
* @param pages Array of pages
|
|
49
|
+
* @returns Aggregated content
|
|
50
|
+
*/
|
|
51
|
+
async aggregateContent(pages) {
|
|
52
|
+
log("Aggregating content from", pages.length, "text pages");
|
|
53
|
+
const result = pages.map((page) => page.pageContent).join("\n");
|
|
54
|
+
log("Content aggregated successfully, length:", result.length);
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { TextLoader };
|
package/man/man1/lh.1
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
.\" Code generated by `npm run man:generate`; DO NOT EDIT.
|
|
2
|
+
.\" Manual command details come from the Commander command tree.
|
|
3
|
+
.TH LH 1 "" "@lobehub/cli 0.0.2" "User Commands"
|
|
4
|
+
.SH NAME
|
|
5
|
+
lh \- LobeHub CLI \- manage and connect to LobeHub services
|
|
6
|
+
.SH SYNOPSIS
|
|
7
|
+
.B lh
|
|
8
|
+
[\fIOPTION\fR]...
|
|
9
|
+
[\fICOMMAND\fR]
|
|
10
|
+
.br
|
|
11
|
+
.B lobe
|
|
12
|
+
[\fIOPTION\fR]...
|
|
13
|
+
[\fICOMMAND\fR]
|
|
14
|
+
.br
|
|
15
|
+
.B lobehub
|
|
16
|
+
[\fIOPTION\fR]...
|
|
17
|
+
[\fICOMMAND\fR]
|
|
18
|
+
.SH DESCRIPTION
|
|
19
|
+
lh is the command\-line interface for LobeHub. It provides authentication, device gateway connectivity, content generation, resource search, and management commands for agents, files, models, providers, plugins, knowledge bases, threads, topics, and related resources.
|
|
20
|
+
.PP
|
|
21
|
+
For command-specific manuals, use the built-in manual command:
|
|
22
|
+
.PP
|
|
23
|
+
.RS
|
|
24
|
+
.B lh man
|
|
25
|
+
[\fICOMMAND\fR]...
|
|
26
|
+
.RE
|
|
27
|
+
.SH COMMANDS
|
|
28
|
+
.TP
|
|
29
|
+
.B login
|
|
30
|
+
Log in to LobeHub via browser (Device Code Flow) or configure API key server
|
|
31
|
+
.TP
|
|
32
|
+
.B logout
|
|
33
|
+
Log out and remove stored credentials
|
|
34
|
+
.TP
|
|
35
|
+
.B completion
|
|
36
|
+
Output shell completion script
|
|
37
|
+
.TP
|
|
38
|
+
.B man
|
|
39
|
+
Show a manual page for the CLI or a subcommand
|
|
40
|
+
.TP
|
|
41
|
+
.B connect
|
|
42
|
+
Connect to the device gateway and listen for tool calls
|
|
43
|
+
.TP
|
|
44
|
+
.B device
|
|
45
|
+
Manage connected devices
|
|
46
|
+
.TP
|
|
47
|
+
.B status
|
|
48
|
+
Check if gateway connection can be established
|
|
49
|
+
.TP
|
|
50
|
+
.B doc
|
|
51
|
+
Manage documents
|
|
52
|
+
.TP
|
|
53
|
+
.B search
|
|
54
|
+
Search across local resources or the web
|
|
55
|
+
.TP
|
|
56
|
+
.B kb
|
|
57
|
+
Manage knowledge bases, folders, documents, and files
|
|
58
|
+
.TP
|
|
59
|
+
.B memory
|
|
60
|
+
Manage user memories
|
|
61
|
+
.TP
|
|
62
|
+
.B agent
|
|
63
|
+
Manage agents
|
|
64
|
+
.TP
|
|
65
|
+
.B agent\-group
|
|
66
|
+
Manage agent groups
|
|
67
|
+
.TP
|
|
68
|
+
.B bot
|
|
69
|
+
Manage bot integrations
|
|
70
|
+
.TP
|
|
71
|
+
.B cron
|
|
72
|
+
Manage agent cron jobs
|
|
73
|
+
.TP
|
|
74
|
+
.B generate
|
|
75
|
+
Generate content (text, image, video, speech) Alias: gen.
|
|
76
|
+
.TP
|
|
77
|
+
.B file
|
|
78
|
+
Manage files
|
|
79
|
+
.TP
|
|
80
|
+
.B skill
|
|
81
|
+
Manage agent skills
|
|
82
|
+
.TP
|
|
83
|
+
.B session\-group
|
|
84
|
+
Manage agent session groups
|
|
85
|
+
.TP
|
|
86
|
+
.B task
|
|
87
|
+
Manage agent tasks
|
|
88
|
+
.TP
|
|
89
|
+
.B thread
|
|
90
|
+
Manage message threads
|
|
91
|
+
.TP
|
|
92
|
+
.B topic
|
|
93
|
+
Manage conversation topics
|
|
94
|
+
.TP
|
|
95
|
+
.B message
|
|
96
|
+
Manage messages
|
|
97
|
+
.TP
|
|
98
|
+
.B model
|
|
99
|
+
Manage AI models
|
|
100
|
+
.TP
|
|
101
|
+
.B provider
|
|
102
|
+
Manage AI providers
|
|
103
|
+
.TP
|
|
104
|
+
.B plugin
|
|
105
|
+
Manage plugins
|
|
106
|
+
.TP
|
|
107
|
+
.B user
|
|
108
|
+
Manage user account and settings
|
|
109
|
+
.TP
|
|
110
|
+
.B whoami
|
|
111
|
+
Display current user information
|
|
112
|
+
.TP
|
|
113
|
+
.B usage
|
|
114
|
+
View usage statistics
|
|
115
|
+
.TP
|
|
116
|
+
.B eval
|
|
117
|
+
Manage evaluation workflows
|
|
118
|
+
.TP
|
|
119
|
+
.B migrate
|
|
120
|
+
Migrate data from external tools (OpenClaw, ChatGPT, Claude, etc.)
|
|
121
|
+
.SH OPTIONS
|
|
122
|
+
.TP
|
|
123
|
+
.B \-V, \-\-version
|
|
124
|
+
output the version number
|
|
125
|
+
.TP
|
|
126
|
+
.B \-h, \-\-help
|
|
127
|
+
display help for command
|
|
128
|
+
.SH FILES
|
|
129
|
+
.TP
|
|
130
|
+
.I ~/.lobehub/credentials.json
|
|
131
|
+
Encrypted access and refresh tokens.
|
|
132
|
+
.TP
|
|
133
|
+
.I ~/.lobehub/settings.json
|
|
134
|
+
CLI settings such as server and gateway URLs.
|
|
135
|
+
.TP
|
|
136
|
+
.I ~/.lobehub/daemon.pid
|
|
137
|
+
Background daemon PID file.
|
|
138
|
+
.TP
|
|
139
|
+
.I ~/.lobehub/daemon.status
|
|
140
|
+
Background daemon status metadata.
|
|
141
|
+
.TP
|
|
142
|
+
.I ~/.lobehub/daemon.log
|
|
143
|
+
Background daemon log output.
|
|
144
|
+
.PP
|
|
145
|
+
The base directory can be overridden with the
|
|
146
|
+
.B LOBEHUB_CLI_HOME
|
|
147
|
+
environment variable.
|
|
148
|
+
.SH EXAMPLES
|
|
149
|
+
.TP
|
|
150
|
+
.B lh login
|
|
151
|
+
Start interactive login in the browser.
|
|
152
|
+
.TP
|
|
153
|
+
.B lh connect \-\-daemon
|
|
154
|
+
Start the device gateway connection in the background.
|
|
155
|
+
.TP
|
|
156
|
+
.B lh search \-q "gpt\-5"
|
|
157
|
+
Search local resources for a query.
|
|
158
|
+
.TP
|
|
159
|
+
.B lh generate text "Write release notes"
|
|
160
|
+
Generate text from a prompt.
|
|
161
|
+
.TP
|
|
162
|
+
.B lh man generate
|
|
163
|
+
Show the built\-in manual for the generate command group.
|
|
164
|
+
.SH SEE ALSO
|
|
165
|
+
.BR lobe (1),
|
|
166
|
+
.BR lobehub (1)
|
package/man/man1/lobe.1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.so man1/lh.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.so man1/lh.1
|
package/package.json
CHANGED
|
@@ -1,44 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lh": "./dist/index.js",
|
|
7
7
|
"lobe": "./dist/index.js",
|
|
8
8
|
"lobehub": "./dist/index.js"
|
|
9
9
|
},
|
|
10
|
+
"man": [
|
|
11
|
+
"./man/man1/lh.1",
|
|
12
|
+
"./man/man1/lobe.1",
|
|
13
|
+
"./man/man1/lobehub.1"
|
|
14
|
+
],
|
|
10
15
|
"files": [
|
|
11
|
-
"dist"
|
|
16
|
+
"dist",
|
|
17
|
+
"man"
|
|
12
18
|
],
|
|
13
|
-
"
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsdown",
|
|
21
|
+
"cli:link": "bun link",
|
|
22
|
+
"cli:unlink": "bun unlink",
|
|
23
|
+
"dev": "LOBEHUB_CLI_HOME=.lobehub-dev bun src/index.ts",
|
|
24
|
+
"man:generate": "bun src/man/generate.ts",
|
|
25
|
+
"prepublishOnly": "npm run build && npm run man:generate",
|
|
26
|
+
"test": "bunx vitest run --config vitest.config.mts --silent='passed-only'",
|
|
27
|
+
"test:coverage": "bunx vitest run --config vitest.config.mts --coverage",
|
|
28
|
+
"type-check": "tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@lobechat/device-gateway-client": "workspace:*",
|
|
32
|
+
"@lobechat/local-file-shell": "workspace:*",
|
|
14
33
|
"@trpc/client": "^11.8.1",
|
|
34
|
+
"@types/node": "^22.13.5",
|
|
35
|
+
"@types/ws": "^8.18.1",
|
|
15
36
|
"commander": "^13.1.0",
|
|
16
37
|
"debug": "^4.4.0",
|
|
17
38
|
"diff": "^8.0.3",
|
|
18
39
|
"fast-glob": "^3.3.3",
|
|
19
40
|
"picocolors": "^1.1.1",
|
|
20
41
|
"superjson": "^2.2.6",
|
|
21
|
-
"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@types/node": "^22.13.5",
|
|
25
|
-
"@types/ws": "^8.18.1",
|
|
26
|
-
"tsup": "^8.4.0",
|
|
42
|
+
"tsdown": "^0.21.4",
|
|
27
43
|
"typescript": "^5.9.3",
|
|
28
|
-
"
|
|
29
|
-
"@lobechat/local-file-shell": "1.0.0"
|
|
44
|
+
"ws": "^8.18.1"
|
|
30
45
|
},
|
|
31
46
|
"publishConfig": {
|
|
32
47
|
"access": "public",
|
|
33
48
|
"registry": "https://registry.npmjs.org"
|
|
34
|
-
},
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "npx tsup",
|
|
37
|
-
"cli:link": "bun link",
|
|
38
|
-
"cli:unlink": "bun unlink",
|
|
39
|
-
"dev": "LOBEHUB_CLI_HOME=.lobehub-dev bun src/index.ts",
|
|
40
|
-
"test": "bunx vitest run --config vitest.config.mts --silent='passed-only'",
|
|
41
|
-
"test:coverage": "bunx vitest run --config vitest.config.mts --coverage",
|
|
42
|
-
"type-check": "tsc --noEmit"
|
|
43
49
|
}
|
|
44
|
-
}
|
|
50
|
+
}
|
package/dist/chunk-LMMQX4CK.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) : x)(function(x) {
|
|
11
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
});
|
|
14
|
-
var __esm = (fn, res) => function __init() {
|
|
15
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
-
};
|
|
17
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
|
-
};
|
|
20
|
-
var __export = (target, all) => {
|
|
21
|
-
for (var name in all)
|
|
22
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
-
};
|
|
24
|
-
var __copyProps = (to, from, except, desc) => {
|
|
25
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
-
for (let key of __getOwnPropNames(from))
|
|
27
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
-
}
|
|
30
|
-
return to;
|
|
31
|
-
};
|
|
32
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
33
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
35
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
-
mod
|
|
39
|
-
));
|
|
40
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
__require,
|
|
44
|
-
__esm,
|
|
45
|
-
__commonJS,
|
|
46
|
-
__export,
|
|
47
|
-
__toESM,
|
|
48
|
-
__toCommonJS
|
|
49
|
-
};
|
package/dist/chunk-OHUXGRBO.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
__commonJS,
|
|
4
|
-
__require
|
|
5
|
-
} from "./chunk-LMMQX4CK.js";
|
|
6
|
-
|
|
7
|
-
// ../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js
|
|
8
|
-
var require_inherits_browser = __commonJS({
|
|
9
|
-
"../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js"(exports, module) {
|
|
10
|
-
"use strict";
|
|
11
|
-
if (typeof Object.create === "function") {
|
|
12
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
13
|
-
if (superCtor) {
|
|
14
|
-
ctor.super_ = superCtor;
|
|
15
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
16
|
-
constructor: {
|
|
17
|
-
value: ctor,
|
|
18
|
-
enumerable: false,
|
|
19
|
-
writable: true,
|
|
20
|
-
configurable: true
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
} else {
|
|
26
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
27
|
-
if (superCtor) {
|
|
28
|
-
ctor.super_ = superCtor;
|
|
29
|
-
var TempCtor = function() {
|
|
30
|
-
};
|
|
31
|
-
TempCtor.prototype = superCtor.prototype;
|
|
32
|
-
ctor.prototype = new TempCtor();
|
|
33
|
-
ctor.prototype.constructor = ctor;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// ../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js
|
|
41
|
-
var require_inherits = __commonJS({
|
|
42
|
-
"../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js"(exports, module) {
|
|
43
|
-
"use strict";
|
|
44
|
-
try {
|
|
45
|
-
util = __require("util");
|
|
46
|
-
if (typeof util.inherits !== "function") throw "";
|
|
47
|
-
module.exports = util.inherits;
|
|
48
|
-
} catch (e) {
|
|
49
|
-
module.exports = require_inherits_browser();
|
|
50
|
-
}
|
|
51
|
-
var util;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// ../../node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/node.js
|
|
56
|
-
var require_node = __commonJS({
|
|
57
|
-
"../../node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/node.js"(exports, module) {
|
|
58
|
-
"use strict";
|
|
59
|
-
module.exports = __require("util").deprecate;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export {
|
|
64
|
-
require_inherits,
|
|
65
|
-
require_node
|
|
66
|
-
};
|