@lobehub/cli 0.0.1-canary.9 → 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 ADDED
@@ -0,0 +1,55 @@
1
+ # @lobehub/cli
2
+
3
+ LobeHub command-line interface.
4
+
5
+ ## Local Development
6
+
7
+ | Task | Command |
8
+ | ------------------------------------------ | -------------------------- |
9
+ | Run in dev mode | `bun run dev -- <command>` |
10
+ | Build the CLI | `bun run build` |
11
+ | Link `lh`/`lobe`/`lobehub` into your shell | `bun run cli:link` |
12
+ | Remove the global link | `bun run cli:unlink` |
13
+
14
+ - `bun run build` only generates `dist/index.js`.
15
+ - To make `lh` available in your shell, run `bun run cli:link`.
16
+ - After linking, if your shell still cannot find `lh`, run `rehash` in `zsh`.
17
+
18
+ ## Custom Server URL
19
+
20
+ By default the CLI connects to `https://app.lobehub.com`. To point it at a different server (e.g. a local instance):
21
+
22
+ | Method | Command | Persistence |
23
+ | -------------------- | --------------------------------------------------------------- | ----------------------------------- |
24
+ | Environment variable | `LOBEHUB_SERVER=http://localhost:4000 bun run dev -- <command>` | Current command only |
25
+ | Login flag | `lh login --server http://localhost:4000` | Saved to `~/.lobehub/settings.json` |
26
+
27
+ Priority: `LOBEHUB_SERVER` env var > `settings.json` > default official URL.
28
+
29
+ ## Shell Completion
30
+
31
+ ### Install completion for a linked CLI
32
+
33
+ | Shell | Command |
34
+ | ------ | ------------------------------ |
35
+ | `zsh` | `source <(lh completion zsh)` |
36
+ | `bash` | `source <(lh completion bash)` |
37
+
38
+ ### Use completion during local development
39
+
40
+ | Shell | Command |
41
+ | ------ | -------------------------------------------- |
42
+ | `zsh` | `source <(bun src/index.ts completion zsh)` |
43
+ | `bash` | `source <(bun src/index.ts completion bash)` |
44
+
45
+ - Completion is context-aware. For example, `lh agent <Tab>` shows agent subcommands instead of top-level commands.
46
+ - If you update completion logic locally, re-run the corresponding `source <(...)` command to reload it in the current shell session.
47
+ - Completion only registers shell functions. It does not install the `lh` binary by itself.
48
+
49
+ ## Quick Check
50
+
51
+ ```bash
52
+ which lh
53
+ lh --help
54
+ lh agent <TAB>
55
+ ```
@@ -0,0 +1,342 @@
1
+ #!/usr/bin/env node
2
+ import { a as __require, n as __commonJSMin } from "./index.js";
3
+ //#region node_modules/.pnpm/pend@1.2.0/node_modules/pend/index.js
4
+ var require_pend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ module.exports = Pend;
6
+ function Pend() {
7
+ this.pending = 0;
8
+ this.max = Infinity;
9
+ this.listeners = [];
10
+ this.waiting = [];
11
+ this.error = null;
12
+ }
13
+ Pend.prototype.go = function(fn) {
14
+ if (this.pending < this.max) pendGo(this, fn);
15
+ else this.waiting.push(fn);
16
+ };
17
+ Pend.prototype.wait = function(cb) {
18
+ if (this.pending === 0) cb(this.error);
19
+ else this.listeners.push(cb);
20
+ };
21
+ Pend.prototype.hold = function() {
22
+ return pendHold(this);
23
+ };
24
+ function pendHold(self) {
25
+ self.pending += 1;
26
+ var called = false;
27
+ return onCb;
28
+ function onCb(err) {
29
+ if (called) throw new Error("callback called twice");
30
+ called = true;
31
+ self.error = self.error || err;
32
+ self.pending -= 1;
33
+ if (self.waiting.length > 0 && self.pending < self.max) pendGo(self, self.waiting.shift());
34
+ else if (self.pending === 0) {
35
+ var listeners = self.listeners;
36
+ self.listeners = [];
37
+ listeners.forEach(cbListener);
38
+ }
39
+ }
40
+ function cbListener(listener) {
41
+ listener(self.error);
42
+ }
43
+ }
44
+ function pendGo(self, fn) {
45
+ fn(pendHold(self));
46
+ }
47
+ }));
48
+ //#endregion
49
+ //#region node_modules/.pnpm/buffer-crc32@0.2.13/node_modules/buffer-crc32/index.js
50
+ var require_buffer_crc32 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
51
+ var Buffer = __require("buffer").Buffer;
52
+ var CRC_TABLE = [
53
+ 0,
54
+ 1996959894,
55
+ 3993919788,
56
+ 2567524794,
57
+ 124634137,
58
+ 1886057615,
59
+ 3915621685,
60
+ 2657392035,
61
+ 249268274,
62
+ 2044508324,
63
+ 3772115230,
64
+ 2547177864,
65
+ 162941995,
66
+ 2125561021,
67
+ 3887607047,
68
+ 2428444049,
69
+ 498536548,
70
+ 1789927666,
71
+ 4089016648,
72
+ 2227061214,
73
+ 450548861,
74
+ 1843258603,
75
+ 4107580753,
76
+ 2211677639,
77
+ 325883990,
78
+ 1684777152,
79
+ 4251122042,
80
+ 2321926636,
81
+ 335633487,
82
+ 1661365465,
83
+ 4195302755,
84
+ 2366115317,
85
+ 997073096,
86
+ 1281953886,
87
+ 3579855332,
88
+ 2724688242,
89
+ 1006888145,
90
+ 1258607687,
91
+ 3524101629,
92
+ 2768942443,
93
+ 901097722,
94
+ 1119000684,
95
+ 3686517206,
96
+ 2898065728,
97
+ 853044451,
98
+ 1172266101,
99
+ 3705015759,
100
+ 2882616665,
101
+ 651767980,
102
+ 1373503546,
103
+ 3369554304,
104
+ 3218104598,
105
+ 565507253,
106
+ 1454621731,
107
+ 3485111705,
108
+ 3099436303,
109
+ 671266974,
110
+ 1594198024,
111
+ 3322730930,
112
+ 2970347812,
113
+ 795835527,
114
+ 1483230225,
115
+ 3244367275,
116
+ 3060149565,
117
+ 1994146192,
118
+ 31158534,
119
+ 2563907772,
120
+ 4023717930,
121
+ 1907459465,
122
+ 112637215,
123
+ 2680153253,
124
+ 3904427059,
125
+ 2013776290,
126
+ 251722036,
127
+ 2517215374,
128
+ 3775830040,
129
+ 2137656763,
130
+ 141376813,
131
+ 2439277719,
132
+ 3865271297,
133
+ 1802195444,
134
+ 476864866,
135
+ 2238001368,
136
+ 4066508878,
137
+ 1812370925,
138
+ 453092731,
139
+ 2181625025,
140
+ 4111451223,
141
+ 1706088902,
142
+ 314042704,
143
+ 2344532202,
144
+ 4240017532,
145
+ 1658658271,
146
+ 366619977,
147
+ 2362670323,
148
+ 4224994405,
149
+ 1303535960,
150
+ 984961486,
151
+ 2747007092,
152
+ 3569037538,
153
+ 1256170817,
154
+ 1037604311,
155
+ 2765210733,
156
+ 3554079995,
157
+ 1131014506,
158
+ 879679996,
159
+ 2909243462,
160
+ 3663771856,
161
+ 1141124467,
162
+ 855842277,
163
+ 2852801631,
164
+ 3708648649,
165
+ 1342533948,
166
+ 654459306,
167
+ 3188396048,
168
+ 3373015174,
169
+ 1466479909,
170
+ 544179635,
171
+ 3110523913,
172
+ 3462522015,
173
+ 1591671054,
174
+ 702138776,
175
+ 2966460450,
176
+ 3352799412,
177
+ 1504918807,
178
+ 783551873,
179
+ 3082640443,
180
+ 3233442989,
181
+ 3988292384,
182
+ 2596254646,
183
+ 62317068,
184
+ 1957810842,
185
+ 3939845945,
186
+ 2647816111,
187
+ 81470997,
188
+ 1943803523,
189
+ 3814918930,
190
+ 2489596804,
191
+ 225274430,
192
+ 2053790376,
193
+ 3826175755,
194
+ 2466906013,
195
+ 167816743,
196
+ 2097651377,
197
+ 4027552580,
198
+ 2265490386,
199
+ 503444072,
200
+ 1762050814,
201
+ 4150417245,
202
+ 2154129355,
203
+ 426522225,
204
+ 1852507879,
205
+ 4275313526,
206
+ 2312317920,
207
+ 282753626,
208
+ 1742555852,
209
+ 4189708143,
210
+ 2394877945,
211
+ 397917763,
212
+ 1622183637,
213
+ 3604390888,
214
+ 2714866558,
215
+ 953729732,
216
+ 1340076626,
217
+ 3518719985,
218
+ 2797360999,
219
+ 1068828381,
220
+ 1219638859,
221
+ 3624741850,
222
+ 2936675148,
223
+ 906185462,
224
+ 1090812512,
225
+ 3747672003,
226
+ 2825379669,
227
+ 829329135,
228
+ 1181335161,
229
+ 3412177804,
230
+ 3160834842,
231
+ 628085408,
232
+ 1382605366,
233
+ 3423369109,
234
+ 3138078467,
235
+ 570562233,
236
+ 1426400815,
237
+ 3317316542,
238
+ 2998733608,
239
+ 733239954,
240
+ 1555261956,
241
+ 3268935591,
242
+ 3050360625,
243
+ 752459403,
244
+ 1541320221,
245
+ 2607071920,
246
+ 3965973030,
247
+ 1969922972,
248
+ 40735498,
249
+ 2617837225,
250
+ 3943577151,
251
+ 1913087877,
252
+ 83908371,
253
+ 2512341634,
254
+ 3803740692,
255
+ 2075208622,
256
+ 213261112,
257
+ 2463272603,
258
+ 3855990285,
259
+ 2094854071,
260
+ 198958881,
261
+ 2262029012,
262
+ 4057260610,
263
+ 1759359992,
264
+ 534414190,
265
+ 2176718541,
266
+ 4139329115,
267
+ 1873836001,
268
+ 414664567,
269
+ 2282248934,
270
+ 4279200368,
271
+ 1711684554,
272
+ 285281116,
273
+ 2405801727,
274
+ 4167216745,
275
+ 1634467795,
276
+ 376229701,
277
+ 2685067896,
278
+ 3608007406,
279
+ 1308918612,
280
+ 956543938,
281
+ 2808555105,
282
+ 3495958263,
283
+ 1231636301,
284
+ 1047427035,
285
+ 2932959818,
286
+ 3654703836,
287
+ 1088359270,
288
+ 936918e3,
289
+ 2847714899,
290
+ 3736837829,
291
+ 1202900863,
292
+ 817233897,
293
+ 3183342108,
294
+ 3401237130,
295
+ 1404277552,
296
+ 615818150,
297
+ 3134207493,
298
+ 3453421203,
299
+ 1423857449,
300
+ 601450431,
301
+ 3009837614,
302
+ 3294710456,
303
+ 1567103746,
304
+ 711928724,
305
+ 3020668471,
306
+ 3272380065,
307
+ 1510334235,
308
+ 755167117
309
+ ];
310
+ if (typeof Int32Array !== "undefined") CRC_TABLE = new Int32Array(CRC_TABLE);
311
+ function ensureBuffer(input) {
312
+ if (Buffer.isBuffer(input)) return input;
313
+ var hasNewBufferAPI = typeof Buffer.alloc === "function" && typeof Buffer.from === "function";
314
+ if (typeof input === "number") return hasNewBufferAPI ? Buffer.alloc(input) : new Buffer(input);
315
+ else if (typeof input === "string") return hasNewBufferAPI ? Buffer.from(input) : new Buffer(input);
316
+ else throw new Error("input must be buffer, number, or string, received " + typeof input);
317
+ }
318
+ function bufferizeInt(num) {
319
+ var tmp = ensureBuffer(4);
320
+ tmp.writeInt32BE(num, 0);
321
+ return tmp;
322
+ }
323
+ function _crc32(buf, previous) {
324
+ buf = ensureBuffer(buf);
325
+ if (Buffer.isBuffer(previous)) previous = previous.readUInt32BE(0);
326
+ var crc = ~~previous ^ -1;
327
+ for (var n = 0; n < buf.length; n++) crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
328
+ return crc ^ -1;
329
+ }
330
+ function crc32() {
331
+ return bufferizeInt(_crc32.apply(null, arguments));
332
+ }
333
+ crc32.signed = function() {
334
+ return _crc32.apply(null, arguments);
335
+ };
336
+ crc32.unsigned = function() {
337
+ return _crc32.apply(null, arguments) >>> 0;
338
+ };
339
+ module.exports = crc32;
340
+ }));
341
+ //#endregion
342
+ export { require_pend as n, require_buffer_crc32 as t };